So, I have the following program which creates to ball shaped sprites. When the user presses the spacebar, the bottom sprite is supposed to move towards the top sprite. When the two touch each other, I want the moving sprite to be reset to its original position.
Trouble is, nothing is moving in my program. What am I doing wrong?
void DarkGDK ( void )
{
dbSetDisplayMode(1680,1050,32);
// turn on sync rate and set maximum rate to 60 fps
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage("Ball.png",5);
dbSprite(2,0,500,5);
dbSprite(3,0,300,5);
dbMaximizeWindow();
// our main loop
while ( LoopGDK ( ) )
{
// update the screen
if (dbKeyState(57))
{
dbMoveSprite(2,8);
}
if (dbSpriteCollision(2,3))
dbSprite(2,0,500,5);
dbSync ();
}
// return back to windows
return;
}
Thanks