How do I control the climbing speed on a ladder

Get help using Construct 2

Post » Mon Apr 10, 2017 4:01 am

I followed this tutorial for climbing ladders:
https://www.scirra.com/tutorials/591/a- ... latformers

I'm trying to get the player to climb a ladder by pressing the up key on the keyboard
Here is what I did :

when player is overlapping ladder
and
the up key is pressed
---> set player platform gravity to 0
set the player Y to player.y-c
Else
---> set player platform gravity to 1500
no matter the value of "c" the climbing speed is always the same
B
30
S
14
G
2
Posts: 28
Reputation: 3,341

Post » Mon Apr 10, 2017 4:22 am

It should be as simple as changing c. Maybe you missed something.

https://www.dropbox.com/s/bp2i7y0g7ie87 ... .capx?dl=0
Mistakes were made.
B
53
S
27
G
114
Posts: 1,695
Reputation: 64,438

Post » Mon Apr 10, 2017 4:42 am

Thank you for the reply, I'm pretty sure I'm missing something but I can't find the mistake

https://www.dropbox.com/s/6c2brko03mk89yk/ladder.capx?dl=0

here I use two speeds 1 and 5 on your example it work perfectly but on mine it doesn't
B
30
S
14
G
2
Posts: 28
Reputation: 3,341

Post » Mon Apr 10, 2017 5:01 am

https://www.dropbox.com/s/8a2ulvjh7033p ... .capx?dl=0

Two problems (unique to going slow, my first example actually didn't work completely right either, it was just hidden by going fast).

1. You didn't turn off using default controls. Jump overrides the move up one pixel event (you jump first, and then move up), so you pick up all the momentum from your jump when climbing the ladder, which is way faster than what you want. With simulate controls, you can put the jump event AFTER the move up one pixel event - you move up one pixel first, and are no longer on the floor, so you can no longer trigger the jump.

2. Having two ladder events using else - the second else runs even if your first one doesn't, setting gravity back to 1500 thus overriding the first set gravity to 0. Moving one pixel at a time is not fast enough to fight against that gravity (moving 50 was).
Mistakes were made.
B
53
S
27
G
114
Posts: 1,695
Reputation: 64,438

Post » Mon Apr 10, 2017 5:15 am

Thank you so much !!! I was aware of the second problem, but the first problem was the issue.

Thank you again for explaining it with details and thank you for your time :)
B
30
S
14
G
2
Posts: 28
Reputation: 3,341


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests