There are several problems with your program.
First, if you want to show sprites, you need to put dbSync() somewhere in your loop-- which you are also missing (the loop).
Second, dbWaitKey() will pause the program waiting for a key stroke--moving the mouse will not affect anything until you press a key on the keyboard (to allow the program to progress).
Third, check the conditions for changing the sprite that is displayed:
You want to display only one image (sprite) at a time?
your sprites are set to the same coordinates (0,0). This will cause the condition to ALWAYS be true
if (mouseX<=image1X|| mouseY<=image1Y){
dbSprite(2,image2X,image2Y,2);//doing this is superfluous. Declareing the image to sprite association multiple time is not needed.
}
else dbSprite(1, image1X, image1Y, 1);//same problem as before....
I think you want something like this:
You need to first declare the image locations to where you want them to be displayed. Declare the image to sprite association:
(before your loop)
dbSprite(1, image1X, image1Y, 1);
dbSprite(2, image2X, image2Y, 2);
and hide the second one:
dbHideSprite(2);
Now you start your loop.
while ( LoopGDK ( ) ){
..... all the stuff you want to display
if (whatever coordinates you want to use as this condition){
dbHideSprite(1);
dbShowSprite(2);
}
else{
dbHideSprite(2);
dbShowSprit1);
}
dbSync();
}
The fastest code is the code never written.