Flash Movement Help

  • Started
  • Last post
  • 2 Responses
  • dprskier

    I have been working very hard to get a character to walk around and jump. I cannot get this to work for the life of me.

    I got the solution from here: :http://www.rit.edu/~ndr0470/gam...

    and I have this following code in my program but it will not work. My movie clips name is player and the bottom of my clip is 450 pixels, can anyone help me? I have been working on making a jumping guy for a day or two, this is starting to get sad. Thanks

    //variables

    var gravity = 3;
    var moving = false;
    var jumping = false;

    function GameLoop() {
    if(jumping == false && Key.isDown(Key.SPACE) == true ){
    dy = 20;
    jumping = true;
    }
    if (jumping == true){
    if( player._y + dy > 450 ){
    player._y = player._y + dy;
    dy = dy - gravity;
    }
    else {
    jumping = false;
    }
    }
    if(moving == false && Key.isDown(Key.LEFT) == true){
    moving = true;
    dx = -10;
    }

    else if(moving == false && Key.isDown(Key.RIGHT) == true){
    moving = true;
    dx = 10;
    }

    else {
    moving == false;
    }

    if (moving == true){
    player._x = player._x + dx;
    }
    }

  • JazX0

    whynot just make a simple motion guide layer and draw it out linearly?

  • dprskier0

    I want it so the user can control which way he moves and jumps, so I do not think that will work.

    Anyone else?