mardi 14 juin 2016

When i code it to go to level two, everything spams on the screen

the giant space is the separation of level two from the game loop

public function gameLoop(e:Event):void {
if (player!=null) { player.x+=vx; //move the player left/right player.y+=vy; //move the player up/down } //end if

        //trace(eArray.length);
        if (myLevel==1)
        {
            runLevel1();

        }//end level 1
        else if (myLevel==2)
        {
            runLevel2();
        }
    } //end game loop
































    public function runLevel2()
    {
        goal=new Goal();
        goal.x=397;
        goal.y=946;
        addChild(goal);

        goalie=new Goalie();
        goalie.x=300;
        goalie.y=950;
        addChild(goalie); //adding goalie

        defender=new Defender();
        defender.x=60;
        defender.y=800;
        addChild(defender); //adding defender level 1

        player=new Player();
        player.x=400;
        player.y=100;
        addChild(player); //adding player

        health=new Health();
        health.width=150;
        health.x=5;
        health.y=80;
        stage.addChild(health); //adding health bar

        bad=new Bad();
        bad.x=Math.random()*800; 
        bad.y=Math.random()*1000;
        stage.addChild(bad);  //adding the bad stuff on the screen

        good=new Good();
        good.x=Math.random()*800;
        good.y=Math.random()*1000;
        stage.addChild(good);  //adding the good stuff on the screen

        trace(p);
        player.gotoAndStop(p);

Aucun commentaire:

Enregistrer un commentaire