How do I jump without changing directions midair?

Get help using Construct 2

Post » Sun Aug 02, 2015 6:04 am

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. :o

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!
B
64
S
16
G
6
Posts: 22
Reputation: 10,797

Post » Sun Aug 02, 2015 8:03 am

I think that jumps in Super Ghouls n Ghosts is what ruins that game :/
B
9
S
1
Posts: 7
Reputation: 522

Post » Sun Aug 02, 2015 8:54 am

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?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Aug 02, 2015 9:37 pm

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

Image

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.
B
10
S
2
Posts: 33
Reputation: 710

Post » Mon Aug 03, 2015 9:29 am

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.
B
64
S
16
G
6
Posts: 22
Reputation: 10,797


Return to How do I....?

Who is online

Users browsing this forum: LaDestitute and 6 guests