Step 6: Pipe Touch Reset

Goal:


Now it’s time to code for what happens when Iron man touches the pipes.

When the player lets Iron man touch the color of the pipes, the game needs to reset.

Steps:

  1. Still on the Iron Man sprite, From Events, place a When green flag clicked block to an empty space.
  2. From Control, add a forever loop, then put an IF statement inside it.
  3. From Sensing, add a touch color block inside the condition of the IF statement.
  4. Click the color bubble and select the button with a picture of a dropper. Use the dropper tool to select the exact color by clicking on an actual pipe in your game window.
  5. Lastly, From Events, place a broadcast reset_game block inside of the IF statement.

Code: