Making spaceship fire
Nobody would face an alien invasion with a harmless spaceship, so we are going to make it fire.
We need to create a variable to manage
bullet_mc DisplayObject and I have said the spaceship can fire only one bullet at a time, so we need another variable to tell us if the spaceship is already firing. If it's firing, it cannot fire. If it's not firing, it can fire.
Add two new class level variables:
private var spaceship:spaceship_mc; private var isFiring:Boolean=false; private var bullet:bullet_mc;
isFiring is the Boolean variable that we'll use to determine if the spaceship is firing.
false means it's not firing.
bullet will represent the bullet itself.
The player will be able to fire with mouse click, so a listener is needed ...