I’m creating a treasure maze game, and there are two levels in the game. The coding down below is for level one, it is used to add on point to the scoreboard when my character overlaps the treasure and at the same time, the treasure will disappear.
However, it doesn’t work for me when I try the same thing for level two, the character would just keep bouncing back to where it was when it overlaps the treasure. Can someone help me with that? Any tips would be helpful.
destroy blocks, change the variable to
otherSprite. If it doesn’t appear in the drop-down when you click on the arrow, you can always drag it from the top of the function. That should take care of you.
Longer answer: When those functions run, two variables are created. The
sprite variable represents the first sprite involved in the collision (
Player for your functions), and the
otherSprite variable represents the second sprite (
Food, etc. for your functions).