Acceleration, Friction, and Wrapping

Create the ySpeed Variable

We are going to pick up where we left off with the previous lesson, so open your project.

The first thing we'll do is abstract the Y position of the ship by creating a variable. Open the Actions window and take a look at the area I'm talking about:

Right now we're hard coding that number five. Ship._y is either plus or minus five. Let's change that to a variable called ySpeed:

Test for mistakes. The project should behave exactly as before:

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player