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 / Sprite collision with multiple sprites

Author
Message
Perokreco
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Bosnia and Herzegovina
Posted: 18th Apr 2007 18:46
I have a problem with sprite collision and couldnt find an answer using search. If I have multiple sprites overlapping how does DBP choose which one to return when I use sprite collision?
zenassem
21
Years of Service
User Offline
Joined: 10th Mar 2003
Location: Long Island, NY
Posted: 18th Apr 2007 21:37 Edited at: 18th Apr 2007 21:39
I'm going to take a stab from memory, to know for sure I'd have to mock up some code. Let me know if this helps.

I'm assuming you are using [SPRITE COLLISION Sprite Number, Target Sprite Number] where (Target Sprite Number is 0). And your asking wich sprite number will be returned if more than 1 sprite is overlapping.

In my past experiments, I remember the results being somewhat random. Under closer inspection, It seemed to depend on which sprite was drawn first. So I never used this command in cases where more than 1 Sprite could have a chance to overlap. Instead, I used an array of current active sprite numbers an looped through it specifying the Target Number of any sprite that could overlap, to ensure accuracy, and multiple hits.)


After more experimenting (Again IF I remeber correctly),if you use [Set Sprite Priority Sprite Number, Priority] SPRITE COLLISION will return the sprite with the highest priority (highest meaning greater value - all sprites have a default of 0 priority to start). Which is still not what you want.

I'm not sure if I ever figured out whether the sprite number itself played a role if prorities weren't used.

Good luck.

Login to post a reply

Server time is: 2024-11-25 19:28:38
Your offset time is: 2024-11-25 19:28:38