How to Make a Vertical Shooter in AS3 – Part 6

Part 6: Finishing Touches

As always, the finishing touches of this game won’t be explained too much by me, in hopes that you actually can do some of this stuff by yourself. Of course, there will always be source files at the bottom if you need to clear anything up.

The first thing I want to do is show the score on the “lose” screen. That’ll be pretty easy, just add a dynamic text field there.

Next, we can make some particles move down the screen so it looks like the player is actually moving forward. We’re going to make them the same speed as the enemies. I’m actually show some code for this one, because it’s also a pretty new thing for me. We’re not going to make a MovieClip for this, we’re going to make dynamic shapes through ActionScript. Here’s the code to place at the bottom:

//adding another enterframe listener for the particles
stage.addEventListener(Event.ENTER_FRAME, generateParticles);

//checking if there already is another particlecontainer there
if(particleContainer == null){
	//this movieclip will hold all of the particles
	var particleContainer:MovieClip = new MovieClip();

function generateParticles(event:Event):void{
	//so we don't do it every frame, we'll do it randomly
	if(Math.random()*10 < 2){
		//creating a new shape
		var mcParticle:Shape = new Shape();
		//making random dimensions (only ranges from 1-5 px)
		var dimensions:int = int(Math.random()*5)+1;
		//add color to the shape*The color for shape*/,1/*The alpha for the shape*/);
		//turning the shape into a square,dimensions,dimensions,dimensions);
		//change the coordinates of the particle
		mcParticle.x = int(Math.random()*stage.stageWidth);
		mcParticle.y = -10;
		//adding the particle to stage

	//making all of the particles move down stage
	for(var i:int=0;i= 400){
			//remove it

Pretty intense, eh? Well, this is a finishing touch, and most finishing touches are pretty intense. If you want to, you can remove this function when the player loses, but I won’t because it adds a pretty cool effect.

Well, that’s actually all that I really have to finish off the game. I hope you had fun making it!


Download Source
(Requires Flash CS3 or above)


Enter your email address:  

Awesome Tutorials