Make player surge towards center of window on jump

0 favourites
  • 4 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • Help! Little Bunny FooFoo is hopping through the forest, but when he jumps he just goes straight up. I want him to jump towards the center of the window so that it looks like he is surging forward and then as he falls move back towards the left.

    I have no clue.

    LittleBunnyFooFoo.capx

    EDIT: I should have mentioned that the goal is to make something Canabalt-like. The player uses platform behavior with the default controls disabled, and on touch simulate jump. The scenery continuously scrolls in the opposite direction to the player.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • If bunny is jumping and his x position is lower than ScrollX (or something else in the middle of the screen), simulate pressing right or set x velocity to a positive value. When he falls, simulate pressing left.

    Using lerp() might make this "sequence" look more natural.

  • I'd say you want to move the bunny towards the centre of the screen when he's jumping and then back while falling. And then you have to adjust the scenery speed to match. There's no point using scrollTo since you can't actually scroll the viewport (as it's the same size as the layout). Anyway I was messing around with it and this the best I could come up with.

    http://dl.dropbox.com/u/8367729/construct/example/Bunny.capx

  • Thank you, thank you Tokinsom and ramones! I really appreciate your taking the time to look into this. I figured it needed some lerping. I got it to go forward pretty smoothly using vectorx, but it kept snapping back to the original X position at the height of the jump. ramones, your solutions just what I had in mind.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)