Home Tutorials Forums Articles Blogs Movies Library Employment Press

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 09-09-2009, 08:17 PM   #1
TheDarkTemplar
Registered User
 
Join Date: Sep 2009
Location: The Palace Of Wisdom
Posts: 1
Send a message via MSN to TheDarkTemplar
Default [AS3] Making First Flash Game

I am making a game where two wizards battle back and forth based off of probabilities of using an attack. Here is the code I have so far:

Code:
var hp1=20;
var hp2=20;

while (hp2 > 0) {

	if (Math.random()*100<21) {
		gotoAndPlay(36);
		hp2=hp2-5;
		} 
	else {
		gotoAndPlay(5);
		hp2=hp2-2;
		}
		

}
stop();
Frames 36-65 are a lightning attack and frames 5-35 are a fireball attack. I don't know how to get it to stop at the end of the attack clip and reset the while loop though so that it will only play the one attack each time. Also, the while loop doesn't seem to be working at all. It just keeps looping long after the HP should be at 0.

Please Help.

Last edited by TheDarkTemplar; 09-09-2009 at 09:19 PM.
TheDarkTemplar is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:15 PM.

///
Follow actionscriptorg on Twitter

 


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.