First of all, try to use code tags the next time, it will make your post much more readable
There is no "return false
" statement in your "mouseOver()
" function at all, so it can never return the appropriate value if the mouse is not over the image! Also a function that returns a value should always have a default return value just in case no other condition is set. So just change your function to this:
int mx = dbMouseX();
int my = dbMouseY();
if(mx >= 200 && mx <= 250 && my >= 200 && my <= 270)
// Default exit, returning false if nothing else is true.
Also you should check your "if
"-conditions in this function. If your image size is 50 x 70 then your bottom right corner pixel is 249, 269 because the pixels start to count at 0, 0. So you should change your if statement to one of these to be precise:
// Either this...
if(mx >= 200 && mx <= 249 && my >= 200 && my <= 269)
// ...or this (same effect)
if(mx >= 200 && mx < 250 && my >= 200 && my < 270)
And additionaly I think you should think about how you handle your sprites. If I remember correctly (haven't worked with DarkGDK in a while) the command "dbSprite()
" always creates a new sprite, so just use this once before your loop (creating one sprite, one ID) and just use "dbChangeSprite()
" or something similar to change the image that your single sprite uses. This will be more effective and save memory.
Hope this helps! (I typed this up in a hurry so excuse me for any stupid mistakes...)