Cannot collect more than 1 coin on the same level
Hey, it's me again ![]()
I've got a slight problem with my scoring system in my game. It's got 3 levels, and I wanted to have about 3 coins to collect on each level, however, I've noticed that only one of those coins can be collected, even though they are identical (dragged and drop the "coin" symbol several times and gave each coin an instance name of "coin") .
My code for the coin:
function enterFrameHandler(e:Event):void //Creates a function called enterFrameHandler, which is based on an Event
{
if(!back.other.coin.collision) //If collision occurs on the coin
{
if (player.hitTestObject(back.other.coin)) //If player hits the coin
{
score++; //+1 added to Score
coins_txt.text = score.toString(); //Displays the score
back.other.coin.visible = false; //Makes the coin invisible
back.other.coin.collision = true; //Makes the collision of the coin true
}
}
}
Anyone got any idea what's wrong with it?
Thanks.
