Project 544: Infinite Runner

3. Program a jump

Using what we learned in the last step, can you program a jump? Try putting the blocks in the correct order yourself before opening up the hints!
Starting point file for this challenge

Your goal

Steps

1. Add a "when green flag clicked" to the player

This is a yellow "events" block. 

2. Start by checking if the player is pressing the space key

Grab an "if-then" block from "control." Connect this beneath the yellow block. Then, find a light blue "sensing" block called "key __ pressed" and put it in the "if" blank. 

3. If so, then set Y Speed to 12 as a result

Put your block that says "set Y speed to 12" inside the "then" blank.

4. Change Y by Y Speed as another result

Put your block that says "change Y by Y Speed" inside the "then" blank.

5. Put the "repeat until" as another result

Put your block that says "Repeat until touching ground" inside the "then" blank. 

6. Put the falling down blocks in the "repeat until touching ground" block

Put your remaining "change Y speed by -1" and "change Y by Y Speed" blocks into the repeat loop. 

7. Repeat your code with a forever loop

Finally, put your forever loop around the entire code!