• 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

Ping Pong - Score

Category : Flash Views : 18886
Version : 8 Rating : 
3.0/5 (41 votes)
  • Currently 3.02/5
  • 1
  • 2
  • 3
  • 4
  • 5
Type : Text Source File: ping-pong-score.zip
Result: See the result


<<< PreviousIndex SeriesNext >>>

Previous | 1 | 2 | Next

Score is very easy to make, for this game we will have two scores. The player score and the opponent score:
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Game Score

They are just dynamic text boxes linked to a variable, "_root.opScore" and "_root.plScore".
Both are align to the right, so we can have 3 digits scores without having the number in the middle of the game.
Free Flash Tutorials, Free Flash Game, Ping Pong Game, Game Score

In the main timeline, paste this code:
var opScore = 0; var plScore = 0;

Open the actions for the ball Movie Clip and make these changes:
//if the opponent made a point if (this._y > 300) { _x = (Math.random() * 180) + 10; _y = (Math.random() * 280) + 10; dir = Math.round(Math.random() * 1); speed = 15; //increase the opponent score by 1. _root.opScore++; if (dir == 1) { var Ang = 45; } else { var Ang = 135; } xspeed = speed * Math.cos((Ang) * Math.PI / 180); yspeed = speed * Math.sin((Ang) * Math.PI / 180); } //if the player made a pont else if (this._y < 0) { _x = (Math.random() * 180) + 10; _y = (Math.random() * 280) + 10; dir = Math.round(Math.random() * 1); speed = 15; //increase the player score by 1. _root.plScore++; if (dir == 1) { var Ang = 45 - 90 ; } else { var Ang = 135 + 90; } xspeed = speed * Math.cos((Ang) * Math.PI / 180); yspeed = speed * Math.sin((Ang) * Math.PI / 180); }
This is all you need to do for the score, very easy and simple.


More cool tech articles from other blogs.

Place your ad here
Loading...


Previous | 1 | 2 | Next

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

Sponsors





Graphic Design & Web Design
Studio | Advertisement | About Webzo | Contact Webzo | Terms of Use | Free Video Tutorials by Helpivds

Copyright © 2007 NR Concepts Ltd. All rights reserved.