#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2013
    Posts
    2
    Rep Power
    0

    Help! character keeps falling through the ground


    hi guys, Im creating a flash As2 side scrolling game but my character keeps falling through the ground. This is for a university assignment so could someone help me please?!. heres the code

    }
    jumping = false;
    jumpStartSpeed = 20;
    currentJumpSpeed = 0;

    onEnterFrame = function(){
    // cant jump if you already jump
    if(Key.isDown(Key.SPACE) && !jumping)
    {
    jumping = true;
    // the velocity in Y is set to 20
    currentJumpSpeed = jumpStartSpeed;
    }

    if(Key.isDown(Key.RIGHT))
    char._x += 5;
    if(Key.isDown(Key.LEFT))
    char._x -= 5;

    if(jumping)
    {
    // "gravity"
    currentJumpSpeed--;
    char._y -= currentJumpSpeed;
    if(char._y > Stage.height)
    {
    // the char can be below the stage and it will cause bugs...
    char._y = Stage.height;
    jumping = false;
    }
    }
    }

    COULD SOMEBODY PLEASE HELP ME FIX IT!
  2. #2
  3. Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    May 2004
    Location
    Superior, CO, USA
    Posts
    2,418
    Rep Power
    1713
    Yes, post in a Flash forum, not a Java forum.

IMN logo majestic logo threadwatch logo seochat tools logo