Wall jump?

Get help using Construct 2

Post » Mon Jan 09, 2012 3:06 pm

How can I recreate a wall jump?

I tried using the platform behavior:

Player.IsByWall[Left]
Keyboard.OnKeyPressed[Space]
     ->Player.simulate[jump]

but nothing :(
B
6
S
1
G
1
Posts: 42
Reputation: 810

Post » Mon Jan 09, 2012 8:40 pm

You will also want to make it push you 'off' the wall.
Perhaps you could consider using physics?
Anyway, I am not sure how 'is by wall' actually works, but here's an idea if it doesn't turn out.
Put two invisible objects pinned the player like so.
Image
If both of the objects are overlapping the wall, then you know you are touching a near-vertical wall.

Of course, that's all if the problem lies in 'is by wall'. Send your capx!
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Tue Jan 10, 2012 3:37 pm

Thanks @sqiddster I managed to figure it out any ways : ) was allot simpler than i though actually.
B
6
S
1
G
1
Posts: 42
Reputation: 810

Post » Tue Jan 10, 2012 3:41 pm

Simulating the jump key doesn't work in mid-air, because obviously pressing shift in mid-air by default doesn't let you jump again. Instead you need to set the vector Y to a negative value, e.g. -500 (if your jump strength is 500).
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,574

Post » Wed Jan 11, 2012 11:56 am

@Ashley, Yeah that's what i did. :)
B
6
S
1
G
1
Posts: 42
Reputation: 810

Post » Mon Jan 21, 2013 5:18 am

Another thing to look at on this from a gameplay perspective is what is the purpose of your wall jump? Basically how do you want them to be able to use it. If you make it too forgiving, it can be used to exploit and bypass large chunks of levels depending on how the level design is setup.

What I tend to do with mine is to put the following checks in place and then react with not only Vector Y -someNumber, but to also do some calculations on the Vector X as well. This way when they wall jump, it also forces them out away from the wall they are currently on so that they cannot just continue to wall jump straight up the wall. They are forced to have to jump in the opposite direction which forces the wall jump to be used the way I intend it to, in order to jump back and forth between two different walls or objects. So here is how I set it up:

Condition 1
On Keyboard Right Arrow Pressed
Condition 2
Player Platform has wall to left
Condition 3
Player Platform in NOT on Floor (Inverse of on floor)
Action 1: Player Set Platform Vector Y to -500
Action 2: Player Set Platform Vector X to 400

Then I repeat this for the other directional arrow:

Condition 1
On Keyboard Left Arrow Pressed
Condition 2
Player Platform has wall to right
Condition 3
Player Platform in NOT on Floor (Inverse of on floor)
Action 1: Player Set Platform Vector Y to -500
Action 2: Player Set Platform Vector X to -400

Of course adjust your X and Y vectors to meet your specific requirements, but the point of mine is to push them far enough away from the wall they are currently on so that they cannot curve back to the same wall and jump off it again from a higher spot. Effectively keeping them from just jumping straight up the wall as much as they want, because that takes no skill.

Instead it pushed them up and away from the wall with enough of an angle that if there is another wall nearby they can then jump off of it to come back to the current wall. In effect forcing them to jump from one wall the other and if they are going to continue to go up, they will have to continue to switch walls with each jump. Basically making a zig zag pattern of jumps between the two walls.

Just food for thought, wall jumps are a great game mechanic, but you have to really be careful in how you make them function or they are easy to exploit and remove the challenge from a game.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Mon Jan 28, 2013 5:35 am

On a side note, I now have a tutorial up on creating wall jumps and also how to tweak and enhance it for multiple scenarios if you are interested: http://www.scirra.com/tutorials/452/platformer-enhancements-wall-jumping
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Wed Feb 06, 2013 12:59 pm

[QUOTE=BluePhaze] On a side note, I now have a tutorial up on creating wall jumps and also how to tweak and enhance it for multiple scenarios if you are interested: http://www.scirra.com/tutorials/452/platformer-enhancements-wall-jumping[/QUOTE]

I have a question about that, the Set vector Y works well and if I change the value of Y the height varies, but if I change the value of X, the movement on the X axis remains the same. This is the case even if I take absurdly large values like +/-4000000000.
Any help would be appreciated.
B
1
Posts: 1
Reputation: 227

Post » Wed Feb 06, 2013 3:21 pm

@mrcollins You need to change the platform max speed and deceleration as well.
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,000


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 20 guests