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.

Dark GDK / Sprite Collision Issue

Author
Message
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 16th Mar 2010 05:20 Edited at: 16th Mar 2010 05:23
Hi, I've having a little issue with the sprite colliding like they should.

The two command dbSpriteHit(), and dbSpriteCollision() are very different, the first checks to see if the sprites are over lapping, the second check to see if the sprite's bounding boxes are over lapping.

But when I put the two commands to the test (in the following program, they seem to act the same).

main.cpp


The two images:
<- save this as a .bmp, imageshack changed the file format.


Anyways, a screenshot of what happens (same outcome when using either formats, topmost one is the mouse controlled sprite, bottom most is the static location one):

(extra spaces = bounding rectangle collision, not an actual sprite collision)

Is this a bug, or am I not doing something right here?

http://www.darkgdk.us/ <- You can now submit pages, upload images, yet were lacking content. We need your help!
entomophobiac
22
Years of Service
User Offline
Joined: 1st Nov 2002
Location: United States
Posted: 16th Mar 2010 09:59
The GDK's 2D isn't very good. The typical suggestion on these forums is to use 3D for purposes of 2D as well, as the 3D is a lot more accurate.

Another suggestion is to check out PlayBasic, which is a specialized solution for 2D game making:

http://www.playbasic.com/
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 16th Mar 2010 22:19 Edited at: 16th Mar 2010 23:28
Quote: "The two command dbSpriteHit(), and dbSpriteCollision() are very different, the first checks to see if the sprites are over lapping, the second check to see if the sprite's bounding boxes are over lapping."


Not quite. ( **EDIT: See below in the P.S. the difference between the two, what I wrote here originally was not correct. **)

There is no difference between "sprite overlap" and "sprite bounding box overlap". If you meant to create pixel-perfect collision, that does not exist as a built-in function. If you create sprites which have transparent areas in them, like your first orange box, then it is still the bounding box which will collide. If you want to exclude transparent areas from collision detection, then I'm afraid you are on your own to write a function for that. I saw somewhere on the forum that somebody has created a plug-in for DB Pro for pixel-perfect sprite collision but I haven't come across with such a function for Dark GDK yet.
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 16th Mar 2010 23:21
P.S. I did a quick test and I have to make a slight correction to what I said above. The difference between dbSpriteHit and dbSpriteCollision is that dbSpriteHit indicates the collision only once when it happens and then stops the indication, while dbSpriteCollision indicates it all the time as long as the two sprites have not moved apart from each other. But it's still true that neither of them are pixel-perfect collisions.
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 17th Mar 2010 01:57 Edited at: 17th Mar 2010 02:01
Well, this is very disappointing, I'd take a look into that play Basic thingy if it had a C++ SDK.

Anyways, does this work with DarkGDK and support pixel perfect collision?
http://darkbasicpro.thegamecreators.com/?f=2dplugin

EDIT:
This boasts pixel perfect collision, is it compatible with DarkGDK?
http://darkbasicpro.thegamecreators.com/?f=extends

http://www.darkgdk.us/ <- You can now submit pages, upload images, yet were lacking content. We need your help!
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 17th Mar 2010 08:50 Edited at: 17th Mar 2010 08:50
Both are Dark Basic Professional plugins, so they are not compatible with Dark GDK. Some plugins are available for both systems but not all.

Login to post a reply

Server time is: 2024-11-20 03:27:18
Your offset time is: 2024-11-20 03:27:18