Buggy IF statement
Here is the actionscript on the frame:
if (newscore>=_level0.score1){
trace("new high score");
trace("new score = " + newscore);
trace("old score = " + _level0.score1);
trace(newscore + ">=" + _level0.score1);
_level0.score1++;
newscore++;
trace("new score = " + newscore);
trace("old score = " + _level0.score1);
}else{
trace("not high score");
====================
Here is the output:
--------------------
new high score
new score = 5
old score = 10
5>=10
new score = 6
old score = 11
I am so confused on this output. The if statement compares two variables and says "if" the new score (newscore) is greater than or equal to the old score (_level0.score1) to do something. It is clearly not the case as you can see the new score is lower than the old score, but it is still acting like it meets the "if" requirement. This is for a local scoreboard using shared objects to store variables. I added the ++ to the variable to make sure the values were integers and not strings. What am I doing wrong here?