Monday, 31 January 2011

Coding for my main game part 2

This is a carry on from my last blog post.
 Up the top it removes the spitfire from the main game scene by placing it at -200 which is off the screen. And then it tells the game when your character has been hit go and play the last scene which is (4). The we have function Marley which is exactly like the bob function but this time it adds a bullet to your character. Then down the bottom it says if your bullet hits the enemy enemy play and remove the spitfire bullet and then place the enemy back at the beginning and add 1 to your score which is scoreNumber++.


The part down the bottom says if up arrows pressed spitfire on the y axis = y + the speed variable and then the same is repeated for the down arrow and then right at the bottom is when you press space it plays function marley which was the bullet.


A lot of code but it makes my game work perfect after doing the screen printing i found a few things i could improve on and i have improved the code a bit.

No comments:

Post a Comment