-
'else' encountered without matching 'if'?
I attempted to make my own code....
but ran into a problem...
heres my code:
Actionscript Code:
on(release) { hp += 50; day += 1; { if (day=30) { else this.enabled = false; } } }
-
.
Hi,
I think you might mean something like this
Actionscript Code:
on (release) { if (day == 30) { hp += 50; day += 1; } else { this.enabled = false; } }
-
thank you
but do you know why my button isn't working? I added this code to my button:
on (release)
{
if (exp == 0)
{
hp -= 10;
_root.gotoAndPlay("talk 1");
}
else if(hp<10)
{
_root.gotoAndPlay ("no hp left");
}
}
but when I test my game, the button doesn't go to the talk frame....
-
Senior Member
Your code looks like it should work. My only guess is that the variable "exp" is not being set to the value of 0. Trace out the variables to make sure they are correct - trace(exp);
Last edited by Steven FN; 08-27-2012 at 05:44 PM.
-
thank you, the problem was that I hadn't even declared my exp variable
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
|