SCRATCH GOLD II
SCRATCH GOLD I
2 of 3

6.11 Collect coins

Your player sprite should have be able to collect coins as it moves through the world.

Add a new variable valled coins to your project.

Select the coin sprite and click show.

screenshot

Add code to your coin sprite so that it only appears in room 1.

screenshot

Add code to your coin sprite so that the sprite hides and 1 is added to the coins variable once the player sprite touches the coin sprite to ‘pick it up’.

coin

Now add code to the Stage to set your coins variable to 0 at the start of the game.

stage

Test your game. Collecting a coin should change your coins score to 1.

×
×

Cart