Introduction to Flash and Actionscript

S4 - Buttons, Keyboard Commands, and HitTest

Assignment 3 - Keyboard Commands

 

We will now try and make a playable game.

You may continue with pacman or design another maze/character.
If designing a different maze it must still contain dots or something that is eaten/collected and enemies that move.

 

Create a new scene - In order to hittest the walls you will need to draw the maze yourself. Each wall will need a different instance name.

Add keyboard control for you 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 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 but if you want to try it now see below (Not required)