Introduction to Flash and Actionscript

S4 - Buttons, Keyboard Commands, and HitTest

Assignment 3 - Keyboard Commands

 

We will now make the game somewhat playable

 

Duplicate your previous maze by copying the layers. Delete all the pacman/ghost tweens.

Add Keyboard Control for your Pacman

Below is an example of KeyboardEvent.Key_Down works, you will have to rotate your images in each function

 

 

To avoid having to click on the stage every time you run, add this at the top of your main program section

//focus the screen

stage.focus=stage;

 

You will have to continuously hit the arrows to move. We will modify this in the next assignment. Feel free to try it now if you have time. (not required)