This script is quite a long script so i will describe parts of the script that are important.
This script is for the main game stage.
At the top of the script we are creating all the variables we need in the game for example, the enemy speed which is 10 and also the UP Arrow, Down Arrow etc.
Then under the variables we have a script for get current Date, time, hour and this makes the background change if its greater than or equals 12 its blue and if its less than or equal to 11 it plays gray, this is by using a 24 hour clock.
At the top of the screen there are event listener's one for, key pressed down and key pressed up and then another one for a restart game function.
Then after the event listeners there is the restart game function and in here it restarts the actionscript to what it was at the start of the game.
Then under the restart game function there is the script to when keys are pressed down so this involves 2 keys and a space bar.
Then here is the script for key press up its the same as the other one just key pressed up. So this means there will be no key's playing when you don't press the key's.
Then you have a function I created called game control and in here there is the enemy movement and also you have a score script which creates the score numbers.
Under this you have got a script which makes the random fire of the enemy's then it says if enemy fire is more than 100 play a function called bob.
Under that you have the bob function which adds the enemy's bullets, the enemy bullets are in the library and are a child when they are added to the stage. Then after the child it positions the bullet so it comes out of the enemy plane.
Then it adds an event listener of enemy fire and then the function come straight after, and then in this function it makes the bullet go - 3 on the x axis the reason for this is because the bullet is going backwards.
Then if the bullet is greater than 400 it disappears off the stage and 400 is off the stage anyway but it removes the child and then the event listener.
The next part of the script is saying if the bullet hits my character Gameover becomes true which means it removes the bullet off the stage and removes 2 event listeners which are enemy fire and game control. And then it move's the characters straight off the screen so you can't see them.