Collision Detection

We can check if two movie clips are colliding by adding a hitTest to our script. Create a new Flash Actionscript 2.0 movie. First create a small movie clip which we'll control with the keyboard. Next, create a rectangular movie clip which we'll use as a wall. After you have created the two clips return to scene 1 and open your library (Command - L). Drag the small clip to the left side of the stage and drag the wall clip to the right side of the stage.

Select the "wall" clip. We'll give it an instance name of wall in the properties panel:

Right click the small clip and select Actions. Copy and paste the following script:

Mouse Control Script

view the resulting animation

Sample Projects