Step 4: Animate Iron Man

Goal:


Now, let’s write code that will animate Iron Man.

When the player presses space, Iron man will change his costume.

Steps:

  1. Still on the Iron Man sprite, From Events, place a When green flag clicked block in an empty space.
  2. From Control, add a forever loop, then put an IF ELSE statement inside it.
  3. From Sensing, add a Key space pressed block inside the condition of the IF ELSE statement.
  4. From Looks, add one “Change costume to” block under the IF and another one under the ELSE.
  5. Change the first costume block to costume1 and the second costume block to costume2.

Code: