Mole Mash V2 with Sprite Layering (mit.edu)
I'm trying this tutorial, i was thinking to add score. When clicked the mole, add the score by 1 but when decrease the score when clicked the hole. I know we could add +2 and -1, but i want to know if it possible to select the sprite with highest Z position, without selecting everything under it. Can somebody help?
Make a list of the sprites and their respective Z indexes. You can then select from there.
wow, that a very complicated solution for a simple task. That's mean i need to compare z with any block and select the highest z.
Then provide some relevant blocks and/or screenshots of what you want to achieve, and you may get a more concise answer/solution....
iam looking for a very simple solution because iam thinking of using it for teaching beginner student. That's a lot of new stuff in one session. If there is a simple solution, i'll be really glad but thank you for your solution. It's definitely helpful
Here is a simple scheme for multiple overlapping Sprites to avoid Sprite Cannibalism ...
Keep a global variable CurrentSprite to identify the Sprite that has been touched, initially an empty string.
When any Sprite has TouchDown event fire, check if CurrentSprite is empty.
If CurrentSprite is empty then
set CurrentSprite to the component block of the Sprite that was touched,
else
ignore the TouchDown
When any Sprite TouchUp
check if the Sprite component equals CurrentSprite value.
if the Sprite component equals CurrentSprite value then
set CurrentSprite to blank text
else
do nothing
When any Sprite Dragged
check if the Sprite component equals CurrentSprite value.
if the Sprite component equals CurrentSprite value then
move the Sprite to the new currentX, currentY
else
do nothing
Search this board for Sprite Cannibalism for examples.
ohyeah, Thank you so much. hehe
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.