0 Favourites

How do I jump without changing directions midair?

  • I'm trying to get something to work like Super Ghouls n Ghosts, where once you make the jump you are committed to it. Lots of platformers let you change direction in midair, but I want to make it so that once you jump you jump like in real life.

    If I ignore user input the player just stops moving altogether. I've tried tinkering with setting speed, vectorx, simulating input while jumping to no avail. Any help is appreciated!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I think that jumps in Super Ghouls n Ghosts is what ruins that game :/

  • Wouldn't this be as simple as setting default controls to no and either adding the condition is on floor or is not jumping and is not falling to the events with the actions: simulate platform pressing right and simulate platform pressing left?

  • One way to get a similar behavior is to use an instance variable and call it something like VectorX. Then, have two conditions:

    So what this does is store your platformer VectorX in the instance variable, and use it when you're jumping/falling as a constant left/right speed until you land. You'll have to manually make the animation face the right way though since you'll still be able to "turn around" but not change your horizontal speed mid-air.

    The thing with simulating left/right is that you will accelerate in the air which seems weird if you let go of everything, and the thing with this method is your jump distance will depend on your speed when you jump. With Ghouls and Ghosts it doesn't really matter because your speed is more or less constant, they have instantaneous acceleration and the jumps are always the same.

  • Thanks tgfcoder. That didn't exactly do the trick but it got me on the right track.

    The missing piece is to set the Platform.VectorX to an instance variable On Jump. Then when the player is jumping or falling the Platform.VectorX is set to the variable. That did the trick!

    One step closer. I'm going for a very different kind of platformer, so I hope to share it soon. Every bit counts.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic Locked topic
195 16,205
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
99 10,159
karshinkoff's avatar
karshinkoff
Unread hot topic
102 6,404
Ashley's avatar
Ashley Construct Team Founder