• Home
  • Free Tutorials
  • Free Video Tutorials

Adobe Photoshop
Autodesk 3ds Max
CSS
Flash
Help Center Live
iPhone
Joomla
Make Money Online!
Mambo
mIRC
Outlook Express
SEO / SEM
Simple Machine Forum
Target Explorer

Space Shooter - Lives and Score

Category : Flash Views : 48029
Version : 8 Rating : 
3.3/5 (63 votes)
  • Currently 3.27/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: space-shooter-lives-score.zip
Result: See the result


<<< PreviousIndex SeriesNext >>>

Previous | 1 | 2 | Next

This tutorial is a series of tutorials that will teach you how to create Space Shooter Game. The tutorial is divided in 5 parts. If you haven't learned the previous tutorials, please see Space Shooter Flash Game

This is the forth part of the development of a Space Shooter game. In this tutorial we will add lives, scores and game over to our game.

Let's start with score.

Open the main timeline code and add this variable:
var score = 0;

Now open the Bullet's code and add this:
this.onEnterFrame = function() { this._x += 9; if (this._x > 550) { this.removeMovieClip(); } for (i = 0; i < _root.nrEnemies; i++) { if (this.hitTest(_root["Enemy" + i])) { _root["Enemy" + i].reset(); _root.score += 10; this.removeMovieClip(); } } }
This is the code we used before to know if a bullet hits an enemy, so we can put the score for killing an enemy there.

If you want the player to lose points for getting killed, just add "_root.score -= PointsToLose" to the code that checks if the player was killed.

The score is done; we just need to show the player his score.
To do that, select the Text Tool and draw it on the stage.
Free Flash Tutorials, Free Flash Game, Space Shooter Game, Lives and Score
Write "Score:"

Now draw another Text box on the stage. Select this new Text box and change these properties:
Free Flash Tutorials, Free Flash Game, Space Shooter Game, Lives and Score

Run the game and see how it works.
Free Flash Tutorials, Free Flash Game, Space Shooter Game, Lives and Score

Now let's make our ship have lives. Add another variable in the main code:
var lives = 3;


del.icio.us digg it Reddit Stumble Upon Technorati

Previous | 1 | 2 | Next

<<< PreviousIndex SeriesNext >>>
How to Video Tutorials on software by Helpvids.com

Video tutorial: Forex trading



Sponsors



Advertisement









Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.