Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Frustrating Code!

Author
Message
Big Shot
20
Years of Service
User Offline
Joined: 27th Apr 2004
Location: dunno...
Posted: 1st Jun 2004 14:21
When I use this code:

if object collision(1,19)>0 then (command)

it works, but I am only able to use it once in my entire game.
Is there a solution?
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 1st Jun 2004 16:11
is that code in your main loop?


* DBP_NETLIB_v1.2 - NOW WITH VARIABLE WATCHER! * Click Logo
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 2nd Jun 2004 03:58
maybe you want to trap the condition once and then stop checking?


fall down seven times, stand up eight
Big Shot
20
Years of Service
User Offline
Joined: 27th Apr 2004
Location: dunno...
Posted: 2nd Jul 2004 01:49
Yes, the code is in the main loop.
Hop a long
20
Years of Service
User Offline
Joined: 12th May 2004
Location: The Code Dump
Posted: 3rd Jul 2004 12:31 Edited at: 3rd Jul 2004 12:31
A bigger picture is needed. What is the follow up (command) you indicate? Why do you need to call the routine again? Perhaps you could detail the over all concept you want.
Big Shot
20
Years of Service
User Offline
Joined: 27th Apr 2004
Location: dunno...
Posted: 12th Jul 2004 22:49
What I wish to achieve is for an action to take place after a certain collision. For example, if my character hits a doorway, the level changes. But being able to use the command once, I can only have one object-collision dependent action. So if I also wanted to have the character lose life if he ran into an enemie, then I would have to forfeit being able to end the level with the same basic command.
JokerZ
AGK Silver Backer
20
Years of Service
User Offline
Joined: 2nd Jul 2004
Location: Perth, Western Australia
Posted: 12th Jul 2004 22:56
Perhaps you need to setup an array of some type (or maybe just a set of flags) and then flag events within the array. Like collide with an item check to see if the item value is contained within the array, if it is then make a collision.

if collision(x,y)>0
for p=1 to 10
if a(p)=1 then life=life-10
next p
endif

a(p) being your monster array
if you needed to, you could then always reset a(p)=0 if you
didn't want that particular collision to occur anymore.

Login to post a reply

Server time is: 2024-09-22 16:23:32
Your offset time is: 2024-09-22 16:23:32