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! / 2d collision layer question

Author
Message
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 4th Mar 2004 10:54
Hi,

Is it possible to change the sprite collision detection layer? For example, sprite_a is a backdrop sprite, sprite_b is a button and sprite_c is a mouse pointer. They are draw in the right order, so backdrop first, then button, then pointer. However when I do check sprite collision(pointer,0), it returns the value of the backdrop sprite and not the button (when I hover over it of course) - any ideas? I want it to return the button sprite.

I'm away from my DBP machine :-( - is there a set sprite collision off command? Even if there is, it solves the above as I can turn of collision for the backdrop, but I do have some cases when sprites overlap and I want to detect exactly what is under the pointer sprite, based on the draw order.

I hope that makes sense

Cheers.
Code Stealer
20
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 4th Mar 2004 13:28
How are you checking which sprite its collding with? I wonder if its detecting both sprites, but only returning the value of the last one it checked. Try using some "if sprite-a and sprite-b = collison print "both hit"" statement to check is both are being detected...That way you know if it is a problem with collisons or a problem with the timing of your checks...

GIve me more power!
the_winch
21
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 4th Mar 2004 14:41
The only things I can think off are.

1. Don't use a sprite for the background layer use paste image instead.

2. Use a textured plane as the background instead of a sprite.

3. Do lots of indiviual spite collision checks between all the sprites except the background sprite, dbpro is proberly doing this internally when you do sprite collision(pointer,0) so it shouldn't be too much of a performance hit.

If you are doing anything advanced you will proberly hit the limit of the dbpro sprite commands and move on to using paste image and your own pixel perfect collision which lets you control the drawing order exactly and have proper collision.
Lampton Worm
21
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United Kingdom
Posted: 4th Mar 2004 15:03
Thanks for the advice

It this stage, the collision I'm describing is for buttons - but they are buttons in an editor, and in the background is the game engine, and sprites go "under" the buttons at times. I could actually use a manual, coordinates based system to detect if the mouse is over a button, that would solve it too.

I already use paste image for the main background btw - what would you say the sprite limits are? I'm using about 500 at the moment and the FPS is ok, not perfect, but ok. That said I've done no optimization at this stage and I probably call some stuff that I don't really need to. I'll consider re-placing all the sprites with pasted images.. I assume it'll boost the fps.

Cheers!
Code Stealer
20
Years of Service
User Offline
Joined: 12th Feb 2004
Location:
Posted: 4th Mar 2004 15:17
you get 64,000 sprites! Plenty to go around...

GIve me more power!
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 4th Mar 2004 23:57
Yeah go with zones for the buttons.

Login to post a reply

Server time is: 2024-05-17 07:29:06
Your offset time is: 2024-05-17 07:29:06