Project 544: Infinite Runner

10. Program scrolling collectibles

The collectibles should also move from one side of the screen to the other, and add a point to the score every time the player touches one.
Starting point file for this challenge

Your goal

Steps

1. Duplicate the scrolling code from the obstacle over

Go back into your obstacle's code. Find the piece of code that the clones to move. Click and drag this over your collectible sprite. Wait until the sprite wiggles! Then, let go. It should be copied into your other sprite now. 

2. Add another "when I start as a clone" block

This is from the "control" section. 

3. Check if it's touching the player

Use an if-statement. An "if-then" block is in the "control" section. 

Find a light blue sensing block called "touching __" and put it in the "if" blank. Change it to check if it's touching your player character. 

4. If so, then change the score variable by 1

Find an orange variables block called "change __ by ___" and put it in the "then" blank. Make it say "change score by 1." 

5. Delete the clone after changing the score

Find a "control" block called "delete this clone" and put it after the orange score block.

6. Repeat the code forever

Put a forever loop from the "control" section around the entire if-statement.