Ok not sure where you learned about IF and ELSE statements but for basic use:
I am not one to use ELSE IF statements because they seem to get confusing when you have too many. You can always use TRACE to test if your function works. But try the following in your code and it should work, just remove ELSE from your ELSE IF's:Code:if(a == b){ // a = b, equals, true }else{ // a != b, does not equal, false }
Almost using one equal (=) is used for setting variables to values while (==) is used for comparing equality between 2 variables. Usually if you have only 1 (=) and your function ran through to it, it would return true every time regardless of actually meeting the conditions.Code:on(release){ if(day >= 1){ day += 1; hp += 50; } if(day == 25){ _root.gotoAndPlay ("cat") } if(day == 30){ this.enabled = false; } }
Also make sure you are reaching the "day" variable by adding "trace(day);" at the top of your code. You may be trying to reach "_root.day" if you set the variable in the main timeline.




Reply With Quote