Goal:
Let’s finish up Iron Man’s movement code.
When the player presses the space key, The Y variable needs to be brought back to a positive number allowing Iron Man to fly upward.
Steps:
- Still on the Iron Man sprite, From Motion, place a Point in direction block to continue the forever loop.
- From Operators, add a subtraction block into the point in direction block.
- In the equation, change the first number to 90 then click on Variables and add a Y block for the second number.
- From Control, add an IF statement below the point in direction block.
- Click on Sensing and add a Key space pressed block into the condition of the IF statement.
- Lastly, from Variables, place a set highscore to block inside the if statement. Remember to click on highscore ,change the variable to Y. and set the last bubble to 4.