-1

error when adding scores. when mc1 hitTestObject line scores plus 1, and when mc2 scores did not increase

stage.addEventListener(Event.ENTER_FRAME, scoring);
function scoring(e:Event):void
{
    if (mc1.hitTestObject(line) || mc2.hitTestObject(line))
    {
        score = +1;
        myscore.text = String(score);
    }
}

please help me :)

1 Answers1

0

You can not write score = +1 to increase the score because it will give you always 1, instead you can do like this :

score ++;

OR

score += 1;

OR

score = score + 1;

For more information take a look on ActionScript 3 fundamentals: Operators.

Hope that can help.

akmozo
  • 9,829
  • 3
  • 28
  • 44