The Second Step in Your 2D game
Ok last time we made our character move around the screen both allowing for diagnoal movement and stop the diagonal movement. Now we will make our character able to move around a bigger map, bigger than the stage is!
OK first you need to add some more code to move the stage so we can move around the map.
So open the actions menu for our character and edit the enterFrame code to match the following:
this._x -= leftspeed;
this._x += rightspeed;
this._y -= upspeed;
this._y += downspeed;
First 'problem' you will see if you play this: IT DOESN'T MOVE!! You are actually wrong there because you are moving the stage in the same direction to what you are moving so it looks like nothing is happening. Try this draw a few lines randomly around the place, even off stage and now try it, your moving aren't you!
You might also be thinking "why are the signs different for the _root code?" well that's simple. With the code we put on the character it was moving how we want (e.g. push up move up).
But say we leave the signs the same then what happens is the stage moves up when you push up which looks like everything is moving down.
Onto Part 3.