smooth jump

Posted on 2009-12-20
Last Modified: 2013-12-26
I am making a 2D platform game that scrolls vertically on higher  platforms  .

MY issue is when i reach a certain height I want the screen to move down. I can do this but it looks awkward.

If I jump up at over 300pixels on screen I then move all objects down to so the player only ever can stand on 300px . IT look a little jerky when the screen moves down suddenly.
Question by:jagguy
    1 Comment
    LVL 1

    Accepted Solution

    Without more information and perhaps a sample of your code it's difficult to give you specific advice, but it sounds like you only need to test when the player is above 300px and if that is the case have jumps not elevate the player but rather shift the world down (Super Mario World style). Some meta-code for you is attached. In the ShiftScreen function there you'll want to move the screen down and the player down, say shifting the screen down at twice the rate of the player. That way the player will float more toward the middle of the screen after the translation. That jump function there is also extremely primitive, since I don't know what your code looks like I just wrote something fairly basic that I thought would be easy to understand.

    Jump(float time) //reduce time each step untill the jump has ended
        if (time <= 0.0f)
        if (Player.Y >= 300)
            Player.Y += jumpHeight / time;

    Open in new window


    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
    As game developers, we quickly learn that Artificial Intelligence (AI) doesn’t need to be so tough.  To reference Space Ghost: “Moltar, I have a giant brain that is able to reduce any complex machine into a simple yes or no answer. (http://www.youtu…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now