mardi 28 mars 2017

Player/character slides down on level 2 platform game

so i created a platform game and it has 2 levels. Level 1 is going smoothly and perfectly but when i go to level 2 (which is in frame4), the player/character slides down suddenly. The character i used at level 1 is the still the character is use in level 2. I checked the instance name and it's right, I renamed the function name too. It does not have any compiler errors/output errors too that's why im having a hard time figuring out why my player does that. Here's my code:

function charMove1()
{
    player_mc.y+=gravity;
    if(leftkeyPressed)
    {
        player_mc.x-=xSpeed;
        player_mc.gotoAndStop(2);
        player_mc.gotoAndStop(1);
    }
    if(leftkeyPressed && leftwallBumping)
    {
        player_mc.x+=xSpeed;
    }
    if(rightkeyPressed)
    {
        player_mc.x+=xSpeed;
        player_mc.gotoAndStop(1);
        player_mc.gotoAndStop(1);
    }
    if(rightkeyPressed && rightwallBumping)
    {
        player_mc.x-=xSpeed;
    }
    if(downwallBumping)
    {
        player_mc.y-=gravity;
    }
    if(upwallBumping)
    {
        player_mc.y+=gravity;
    }
    //set condition for moving the background, player stays at same position with this code
    if(rightkeyPressed && player_mc.x>stage.stageWidth/2+50)
    {
        background1_mc.x-=backgroundSpeed;
        player_mc.x-=xSpeed;
    }
    if(leftkeyPressed && player_mc.x<stage.stageWidth/2-50)
    {
        background1_mc.x+=backgroundSpeed;
        player_mc.x+=xSpeed;
    }
}

Aucun commentaire:

Enregistrer un commentaire