Project 442: Infinite Flying Game

3. Program the "flappy" movement

Using what we learned about the coordinate plane and variables, can you start building these new movement controls? Let's also set the hero's starting position and angle.
Starting point file for this challenge

Your goal

Steps

1. Create a variable to keep track of Y Speed

Click on the orange "variables" block and "Make a new variable." Calling it something like "YSpeed" or "YAcceleration" might make the most sense! 

2. Set your speed variable to 1 at the start of the game

Grab an orange "set __ to ___" and set it to your new variable, and 1. 

3. Change the hero's Y value by your Y speed variable, forever

Inside of the forever loop, but outside of the if-then-else statement, put down a dark blue block "change y by ___." Now we want to change Y by a variable, so go to your orange variable blocks. Grab the bubble that has your variable name in it, and put it inside the blue block's blank space. 

4. Delete the old motion blocks

Get rid of those old "change Y by ___" that are sitting in your if-then-else statement, we don't need them anymore! 

5. Change your Y Speed variable when the mouse is clicked

Inside the "then" part of this statement, grab an orange "variables" block called "change ___ by ___." Set it to your Y Speed variable, and then change it by a positive number. 

6. Change your Y Speed variable when the mouse isn't clicked

Inside the "else" part of this statement, grab an orange "variables" block called "change ___ by ___." Set it to your Y Speed variable, and then change it by a negative number. 

7. Test out different speeds

Click the green flag to test this game out. Try using different number values and see what feels best for your game. 

8. Add a slight turning effect

Can you figure out a way to have the hero point slightly downwards when its falling, and slightly up when it's flying? 

9. Set your hero's starting position and angle

You'll need the blue motion block "go to x: __ and y: __" and the dark blue motion block "point in direction ___." 

Thinking about a coordinates graph, what coordinates would make your hero go to the left side of the screen, at a middle height? 

What direction makes your hero face forward?