will check if we press the SPACE bar, check the boolean _pushshoot, and it check if our weapon is out of cooldown, after that the laser is created in the screen on the mid position of the ship and rescalled to looks better, so this laser is added inside of _mcHolder and the addChild put it in our scene, the setChildIndex just tell to the laser goes to the front of the scene and for last the actual weaponcooldown is set with the value of the max weapon cooldown.

In movements, it is moving everything inside of the laserList array and if it goes out of our resolution it will be removed.

Now, if you goes to your Spaceship.fla and test it, your ship will be shooting every time that you hit SPACE bar. 😉

II – Playing Pew-Pew Sound

For play pew-pew sound, first you’re gonna need a lasershoot sound, and you can download it HERE.

It’s the same that i used in my Cocos2d tuturoail/

After the download of the lasershot.mp3. Open your flash document Spaceship.fla, and drag the laserhot.mp3 to your library.