# Problem with character jump

Discussion in 'Physics' started by chrisswingsx, Dec 6, 2018.

1. ### chrisswingsx

Joined:
Oct 28, 2018
Posts:
6
I have a 2D Runner for mobile and I put a coroutine so that every 5 seconds it increases its speed in 0.2 starts with a speed of 5 after 5 seconds it gets in 5.2 then 5.4 but the problem is that the more the speed increases the jump in x is bigger in travel and I would like the jump in x to be the same one with which it starts. Help me please. sorry my english is not so good

2. ### xred13

Joined:
Jul 14, 2018
Posts:
74
What do you mean with jump in X increases? Could you post a video or something showing what happens?

3. ### chrisswingsx

Joined:
Oct 28, 2018
Posts:
6
Coordinate Horizontal= X Vertical=Y

4. ### SparrowsNest

Joined:
Apr 6, 2017
Posts:
1,477
Code or gtfo, we can't help without it.

5. ### dgoyette

Joined:
Jul 1, 2016
Posts:
1,591
It sounds like conceptually your approach is a little flawed. Obvious this is just guesswork, but I'm assuming that your jump distance is based on how fast the player is moving, and that he stays in the air for a fixed amount of time. The faster you make the player move, the further he can jump, because you're moving him along through the world faster and faster.

The only thing I can think of is that instead of adjusting the player's speed, you instead adjust Time.timeScale to make the game move faster. That will cause everything to go more quickly, without changing the physics. Your player will still jump the same distance, he'll just do it in a shorter amount of time. This might look bad though, as the whole world will speed up, not just the player.

Otherwise I think you'd need to find some other approach to managing your player's air time, which probably won't play nicely with the physics simulation.

Another approach is to embrace the player's added jump distance, and design your levels such that he needs to jump further. For example, start with shorter jumps, and then over time the jumps get further and more precise as the player's jump distance increases.