-
Variable on Main Timeline-If Statement?
Okay, so in my main timeline, I have this:
Code:
gameover = false
if(follower.hitTest(target))
{
gameover=true
gotoAndStop(2);
clearInterval(NormEnemy);
clearInterval(GreenEnemy);
clearInterval(PacEnemy);
clearInterval(IshEnemy);
clearInterval(RainbowEnemy);
clearInterval(DylEnemy);
clearInterval(lolEnemy);
}
if (gameover=false)
{DestroyEnemy=setInterval(KillEnemy, 10000);
function KillEnemy () {
removeMovieClip(follower)
}
} else if (gameover=true)
{{FastKillEnemy=setInterval(FKillEnemy, 1);
function FKillEnemy () {
removeMovieClip(follower)}}}
But for some reason, neither of the functions activate. They worked fine until I added the if statements. Does anybody know what might be causing this? Thanks in advance.
-
put a double == in your if statements
e.g. if (gameover == false){
-
Yeah, double == are just for testing a variable's value, right? It still did nothing though. o-o
-
try putting the functions outside and just calling them. also be sure you include your semi colons at the end of every line!
and maybe your gameover = false at the top should be var gameover = false;
so it would be
var gameover = false;
if(follower.hitTest(target))
{
gameover=true;
gotoAndStop(2);
clearInterval(NormEnemy);
clearInterval(GreenEnemy);
clearInterval(PacEnemy);
clearInterval(IshEnemy);
clearInterval(RainbowEnemy);
clearInterval(DylEnemy);
clearInterval(lolEnemy);
}
function KillEnemy () {
removeMovieClip(follower);
}
function FKillEnemy () {
removeMovieClip(follower);
}
if (gameover==false){
DestroyEnemy=setInterval(KillEnemy, 10000);
KillEnemy ();
} else if (gameover==true){
FastKillEnemy=setInterval(FKillEnemy, 1);
FKillEnemy ();
}
Last edited by rachelg; 09-06-2012 at 06:15 AM.
-
try putting the functions outside and just calling them.
Thank you so much it worked! But I'm pretty sure I can move a few functions by myself. :P Thanks again.
Last edited by Beocro; 09-06-2012 at 06:18 AM.
-
great!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|