Project 265: Gravity Dodger

7. Clone Movement

Now that we have a bunch of "Enemy" clones, let's add code to make them fall to the ground.
Starting point file for this challenge

Your goal

Steps

1. Import enemy variables

Which variables should we initialize for our enemy?

2. Initializing enemy variable

Since we want our enemy to fall down, we are going to use negative numbers. Set "y speed" to -1 and "gravity"  to -0.3
What would happen if we changed these numbers to positive? What would happen if we increased or deceased these numbers?

3. Select the proper loop type for enemy movement

If we want are enemy to stop after if hits the ground what type of loop will we use? Do we want our enemy to fall forever? Do we want our enemy to fall for a specific number of steps? Do we want our enemy to fall until a certain condition is met? 

4. Make sure the enemy falls until it reaches the bottom of the screen

Using a "repeat until ____" loop, Let's build an inequality based on the y coordinates that we stop enemy movement once the enemy reaches the bottom of the screen.  First we'll need a " ___ < 50 ?" block from Operators, then grab a "y position" block from the motion tab.  Finally adjust the coordinate to be the bottom of the Screen, or y= -170.

5. Have the enemy move using our variables

We created y speed and gravity earlier in the project. Using some motion blocks and variable blocks, let's get the enemies to accelerate as they fall.  Get a "change y by ___" block from the Motion Tab, and a "change ___ by ___" block from Variables.  Then we'll plug in the "y speed" and "gravity" blocks to these two blocks.   "y speed" will go with the motion block and then we will change "y speed" by "gravity".

6. Delete the clone once movement is finished

Where can we place a "delete this clone" block so that it will go away once the movement is complete?

Put it after the "repeat until ____"   statement.

7. Enemy Falling

Test to make sure the enemies fall until they get to the bottom of the screen!