We already have some information printed to the screen, showing the screen size and pointer position, now we are going to add some more to help with the picking up function.
Immediately after the following lines in the do/loop;
printc( "Pointer: " )
print( str( getPointerX() ) + " x " + str( getPointerY() ) )
printc( "Sprite: ")
print( str( getSpriteHit( getPointerX() , getPointerY() )))
Compile and run the project and now as you move the pointer over a sprite, it's reference will be shown at the top of the screen. If there is no sprite at the position of the pointer is will show 0
At last I get to use the finger we created right back at the start.
If you extend the panel - yes that still works - and move the pointer over that, you will also notice it returns the references of the sprites used to make up the panel as well.
So now we have a way to identify which sprite is at the cursor position.
No comments:
Post a Comment