dbMoveSprite can only move in two directions relative to the rotation of a sprite. A sprite with a rotation of 0 or 180 will move up/down. A sprite with a rotation of 90 or 270 will move left/right. But rotating the sprite might look weird, so my suggestion is to have a variable for each of the sprite's coordinates.
#include "DarkGDK.h"
void DarkGDK ( void )
{
dbSyncOn ( );
dbSyncRate ( 60 );
dbLoadImage ( "background_forest.jpg", 1 );
dbLoadImage ( "panda.png", 2 );
dbLoadImage ( "grunt.png", 3 );
dbSprite ( 1, 0, 0, 1 );
dbSprite ( 2, 100, 100, 2 );
dbSprite ( 3, 100, 400, 3 );
dbSetImageColorKey ( 255, 0, 255 );
int x = 100,
y = 100;
while ( LoopGDK ( ) )
{
if(dbUpKey())
y -= 2;
if(dbDownKey())
y += 2;
if (dbRightKey()==1)
{
x += 2;
}
if (dbLeftKey()==1)
{
x -= 2;
}
if (dbSpriteCollision(2,3) ==1)
{
dbWaitKey();
}
dbSprite(2, x, y);
dbSync ( );
}
return;
}
Your_Health = (My_Mood == HAPPY) ? 100 : NULL;