The Approach

[ LiB ]

I decided to tackle this piece by piece. The first thing I decided to create was the star field. This star field needs to scroll to the left at all times while moving the stars with different speeds, sizes, and opacities. I accomplished this by using, from the library, one linked symbol that was nothing more than a white circle with no stroke. When I created the instances with attachMovie , I assigned new _alpha , scale and velocity values. To move all of them once they were created, all I did was loop through each instance within each frame while adding the velocities to their x values. This caused the simultaneous motion.

The player's ship was one of the easiest things to create. I first drew the ship with all the built-in animations I wanted (like the engine flame animation) and made it into a symbol that can be linked into the movie.

As far as motion goes, the player is restricted to moving the ship up and down with the respective keyboard arrows.

The player needed some missiles with which to attack, so I also created a symbol for the missiles. This symbol helped the program create a certain number of instances that can be active at one time. In other words, one variable controls how many missiles the player can shoot at once.

The enemies that I created for this game are very dumb. All they do is float to the left while moving in a sine motion. I created the enemies in much the same way I created the star particlesmuch of the difference is in the motion code.

After a few seconds of battle, I have the big Boss come out to kick some butt. The energy bar at the bottom of the screen is his, the one up top is the player's, and the battle is to the end. The Boss was created in much the same way the main character was created, except that the computer moves him up and down at all times. I wanted the Boss's bombs to launch at random. I also set them up the same way I did the star field and the main character's missilesin such a way that only a certain number can be launched at once.

Once I had made decisions on all these factors and elements, I began setting up the source file.

[ LiB ]


Game Development with ActionScript
Game Development with ActionScript
ISBN: 1592001106
EAN: 2147483647
Year: 2004
Pages: 162
Authors: Lewis Moronta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net