19 Building the Game — Phase II: Movement and Powerups

Movement

Moving MovieClip instances in Flash is as easy as changing their _x and _y properties. Making them move convincingly in a game requires a small amount of math to approximate simple physics. The math is almost trivial, but it can be confusing, especially when each calculation needs to be done for both the x and y coordinate (the _x and _y properties).

Vectors and Scalars

The Astro Sweeper game makes use of a VectorMath class that simplifies some of the calculations by treating the two coordinates as one entity — a Vector. A Vector, simply put, is a mathematical entity with more than one component. In the context of vectors, normal single-component numbers are called “Scalars” . The ...

Get Understanding Macromedia Flash 8 ActionScript 2 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.