First it calculates the offset for it. The code describes how it works, but not so fantastically. If you experiment with it a little and think a bit I think you could understand what happens with the code.
In this tutorial we will check for collisions between MC's (Movie Clips) that are created through actionscript. The way we will be doing it won't lag very much compared to a lot of the other ways you can do this and I will explain why later. I am using Adobe Flash CS3 but Macromedia Flash 8 and Flash MX 2004 will work as well. If you are using Flash CS3 make sure you select a AS 2.0 file.
1. First open up a new Flash document. For this example I set my stage to 400x200. The first object we are going to create is our target movie clip. I made a box that was 150x150 and filled it with a medium gray. Once you make the box select it and press F8 to make it a symbol. Make sure that Movie Clip is set as the behavior type and name it target. Now that it is a symbol give it an instance name of target_mc.
Learn how to make a basic maze game with collision detection. Collision detection is useful in many different game type scenarios and is easier than you might think. The Collision Detection ensures that the Blue Ball (or Player) does not cross the red lines of the Maze.