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
#include "DarkGDK.h"
void DarkGDK() {
dbSyncOn();
dbSyncRate(60);
dbHideMouse();
//dbSetImageColorKey(255, 0, 255);
// change .png to .bmp
dbCreateAnimatedSprite(1, "../the-orange-box.png", 1, 1, 1);
dbCreateAnimatedSprite(2, "../the-orange-box.png", 1, 1, 2);
while (LoopGDK()) {
dbCLS();
dbSprite(1, dbMouseX(), dbMouseY(), 1);
dbSprite(2, dbScreenWidth() / 2, dbScreenHeight() / 2, 2);
if (dbSpriteHit(1, 2)) { // Sprites overlapping
dbPrint("A sprite is hitting.");
}
if (dbSpriteCollision(1, 2)) { // Sprite's Bounding box overlapping
dbPrint("A sprite is colliding.");
}
dbSync();
}
return;
}
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!