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.

2D All the way! / Sprite Collision

Author
Message
exhaulted
19
Years of Service
User Offline
Joined: 27th Mar 2003
Location:
Posted: 27th Mar 2003 13:58
Lo all,
It's been a while since i have been using DB, just getting back into the swing of things. Anyway i gotta be quick cus im at work

The sprite collision command returns wether a sprite has collided with another sprite e.g sprite collision (1,0) so if sprite 1 collides with any sprite it returns 1. Is there a command to return the number of the sprite that collided with sprite 1.

Nice to be back all. x-d
andrew11
19
Years of Service
User Offline
Joined: 23rd Feb 2003
Location: United States
Posted: 27th Mar 2003 14:59 Edited at: 27th Mar 2003 14:59
You'd have to do something like this:



"All programmers are playwrights and all computers are lousy actors." -Anon.

<--- Just.. changed.. my. avatar... Ouch, my head!
exhaulted
19
Years of Service
User Offline
Joined: 27th Mar 2003
Location:
Posted: 27th Mar 2003 15:24
Thanks for the idea Andrew, i need it to be done without knowing how many sprites to check.

I suppose i could put it into a while loop -



Would this work? (Provided all of the sprites were numbered consecutively with no gaps )

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 27th Mar 2003 19:16
Why not use this :
exhaulted
19
Years of Service
User Offline
Joined: 27th Mar 2003
Location:
Posted: 28th Mar 2003 10:35
Becaus that code would just return a 1 or 0 depending on wether a collision had been made. I want the function to return the number of the sprite that the target sprite collided with.

IanM
Retired Moderator
20
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 28th Mar 2003 14:16
Quote: "This command will return a one if the specified sprite is overlapping the target sprite specified. If a target sprite has not been specified and a value of zero has been used, this command will return the sprite number of any sprite overlapping it."
exhaulted
19
Years of Service
User Offline
Joined: 27th Mar 2003
Location:
Posted: 28th Mar 2003 17:09
Hehe - so it does. Thanks Ian x-d

Login to post a reply

Server time is: 2023-02-04 22:04:20
Your offset time is: 2023-02-04 22:04:20