Developing a space shooter game [ October 07, 2004 ] by Richard Nias aka Crashlanding
In this collection of tutorials, the author explains how to create a basic shooter game, considering all its different aspects: movement, shooting, enemies, sound, etc.
What is the point of playing a game if you don't know how well you played? You need to know your score because otherwise people just won't bother to play. Luckly for us, scores are actually quite simple. Lets look at the swf:
It's not that different from what we had in the last tutorial, but in the top left hand corner it displays your score. So first you need a dynamic text box.
Write score as static text and make a dynamic textbox next to it and give it the varible name "score" as shown above. Now to the beginning of your code put:
_root.score = 0;
This is just to set the original value of score to 0. But where do we put the code to add scores? If we put it in the hitTest bit of the bullet code, then the score will keep going up and up untill the death animation is finished. The best thing to do is to put the code at the end of the death animation. So, in your enemy movieclip on the last frame put:
_root.score += 50;
Simple! Finished! If you have any problems email me at firstname.lastname@example.org and I will answer as well as I can. If you want to download the .fla click here.
Richard Nias aka Crashlanding
South-east London, UK
Had Flash for 1 1/4 years now. I learnt from the help files before finding gotoandplay and flashkit, getting me intrested in games.