Home

Egg Directory / Search

New Eggs / Best of New

New Blogs / Pics / Activity
New Files / Movies
Community Forum

Group Directory

 

 
General Discussion
Talk about everything under the sun. Unless it’s against the rules.
You must have a member level of 3 or greater to post new topics here and a level of 3 to post replies.
Actionscript/Flash help
   
Post New Topic Post Reply Add To Watchlist
Author
Message


DannoTheManno


Power Egg
Member Lvl: 15
Egg Points: 23084
Posts: 3400

Posted: Dec 11, 2008 3:31 p.m. - Subject: Actionscript/Flash help

Okay so I have some code for a whack-a-mole type game (By the way, if you don’t know Action5cript, can you please give me a good community for this kind of help BESIDES NEWGROUNDS.)
And don’t worry about the // *, they are just notes.

Quote:
init();

function init(){

for(i = 0; i < 10; i++){
_root.attachMovie("target", "target_" + i, 100 + i);
theTarget = eval("target_" + i);
theTarget._x = i * (theTarget._width + 5) + 50;
theTarget._y = 200;
theTarget.state = "down";
theTarget.gotoAndStop("down");
//larger popUpRate makes targets pop up more frequently
theTarget.popUpRate = .01;
//larger resetFrames makes targets stay up longer
theTarget.resetFrames = 12;

theTarget.onEnterFrame = function(){
if (this.state == "down"){
//pop up randomly
if (Math.random() < this.popUpRate){
this.state = "up";
this.gotoAndStop("up");
this.counter = this.resetFrames;
} // end "pop up" if
} else {
//count down because target is currently up
this.counter--;
if (this.counter < 0){
//go back down
this.state = "down";
this.gotoAndStop("down");
misses++;
} // end if
} // end "up or down" if
} // end enterFrame

theTarget.onPress = function(){
if (this.state == "up"){
this.state = "down";
this.gotoAndStop("down");
hits++;
} // end if
} // end onRelease
} // end for loop
} // end init


So what I’m trying to do is make so if you get a certain amount of misses like 10, it goes to the lose frame, and if you get like 5 hits it goes on to the next level frame.
All I need is the damn code for it.
I tried:
If {(misses == 10))
_root.GotoAndStop ("lose");
}

All it does is keep the misses at 0

Please halp


igloo_


Master Egg
Member Lvl: 44
Egg Points: 1460117
Posts: 3815

Posted: Dec 11, 2008 3:33 p.m. - Subject:

I would help you but I forgot absolutely everything that I learned when I took a class on Flash
Home | Contact Us | Sign Up
Visit our companion site, Prankpedia.com
Please read the LEGAL DISCLAIMER & CONTENT GUIDELINES
© 2009 rotteneggs.com - A Social Network for Pranksters.
0.171518 (Server 1)