vendredi 13 janvier 2017

How i can made a score counter to when player has choose level from menu

I made a score counter and if has player start level 1 and if has win,counter is keep working to next level.( Level = frame ) it's not exist any issue so far.

But when player has choice to level from menu and start level 2,counter is not work.Level 2 start from to frame 116.I get a "NaN" error.

I write a code like this scrore frame 1

var Scorecounter:Number = 0;

And Score_t1 it's a dynamic text.Use counter code on frame one

function checkButtonsone():void
{
    if(fisoneclicked21 && fistwoclicked)
    {

    Scorecounter = Scorecounter + 10;
    Score_t1.text = (Scorecounter).toString();

    acmessage.visible = true;
    acmessage.play();

    gotoAndPlay(116);//LEVEL 2
}
}

and on level 2

function checkButtonponelev2():void
{
    if(fish1clickedleveltwo && fishtwoclickedleveltwo && 
    fishthreeclickedleveltwo)

    {           
    Scorecounter = Scorecounter + 10;
    Score_t1.text = (Scorecounter).toString();

    famessage.visible = true;
    famessage.play();
}
}

I'm not using keyframe beetwen two levels.So score frame continue until last frame.(285)

Aucun commentaire:

Enregistrer un commentaire