Introduction to Flash and Actionscript

S4 - Buttons, Keyboard Commands, and HitTest

Assignment 5 - Collisions


Delete the dots when pacman hits them.

Increase the Score and display in a text box

End the game when pacman hits a ghost.

Add an ending scene that gives the user the option to play again or return to the main menu

(You will need to have the last ghost event listener call the first)


To Move to a New Scene

When the game is over call the EndScreen funtion to delete any eventlisteners you do not need. You may also need to delete some of your movie clips.

When you move to a new scene you need to remove all event listeners and all



Add a Scoring System and display it in a text boxl



Above and Beyond ICS3U (Level 4)


Hittest your walls in you hittest function, so that pacman cannot travel through them. You will need invisible objects over them to hit.


At the start of your program initialize a hit

var hit:Boolean; // A Boolean variable is either true or false


In a checkHit function

In the KeyDown Function modify your controls for hit true, or hit false

if (hit == false)


// All your normal commands


if (hit == true)


// move in opposite direction (incease number slightly)



The hittest will be slightly glitchy. We will learn how to make it better in the next assignment.