Hey there. I'm stuck. This was quite easy in AS 2, but I can't seem to figure out how to solve it in AS 3.
I want to make a high score system. Everytime "helten" hits "smilefjes" I want the text field called "hiscore" that starts with 0 to go 10 points up. My first attempt was the following:
Code:
addEventListener(Event.ENTER_FRAME, onLoop, false, 0, true);
function onLoop(evt:Event):void {
if (helten.hitTestObject(smilefjes)) {
hiscore.text += 10;
}
}
What happens when I run this is that the text field just adds a zero next to the zero that already is there.
I have 2 questions. First, why doesn't it add the 10 instead of just a zero? Second, how can I make it work so that the 0 is replaced with the 10 when "helten" hits "smilefjes", and the second time the 10 is replaced with 20 etc.