Hi! I'm making an endless running side scrolling game and the jumping jumps too far when the speed is increased. The speed of the game is increased overtime and the jumping jumps further out.
For example at lets say at speed 1 when the player jumps the player moves 100 px, but at speed 5, when the player jumps the player moves 500 px. How can I make the player only jump a certain distance regardless of the speed?
I haven't looked at your code but, if you are using dt and you multiply it by the speed, make sure to divide it again by the speed when you are jumping.
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette! personal page and a raycaster
Davidobot wrote:I haven't looked at your code but, if you are using dt and you multiply it by the speed, make sure to divide it again by the speed when you are jumping.
Well when the game speeds up, I add the speed to the scrolling so it speeds up the map movement. But, that results in the jumping to jump further.
Davidobot wrote:I haven't looked at your code but, if you are using dt and you multiply it by the speed, make sure to divide it again by the speed when you are jumping.
Well when the game speeds up, I add the speed to the scrolling so it speeds up the map movement. But, that results in the jumping to jump further.
That's because, as you are in the air, the map moves under you. You can try dividing the jump speed of the player by the speed?
PM me on here or elsewhere if you'd like to discuss porting your game to Nintendo Switch via mazette! personal page and a raycaster
In your place, I personally would leave it like it is, because this is the physically correct behavior.
If you still want to change it you have two options: Either change the jumping height (by making the initial jumping velocity smaller) or increase gravity. Since the games speed increases you have to decrease the air time of the player to keep the jumping distance constant.
Davidobot wrote:I haven't looked at your code but, if you are using dt and you multiply it by the speed, make sure to divide it again by the speed when you are jumping.
Well when the game speeds up, I add the speed to the scrolling so it speeds up the map movement. But, that results in the jumping to jump further.
That's because, as you are in the air, the map moves under you. You can try dividing the jump speed of the player by the speed?
Ah ok, I just added the map speed to the jumping velocity and now the jumping is relative to the map speed. Thanks!
micha wrote:In your place, I personally would leave it like it is, because this is the physically correct behavior.
If you still want to change it you have two options: Either change the jumping height (by making the initial jumping velocity smaller) or increase gravity. Since the games speed increases you have to decrease the air time of the player to keep the jumping distance constant.
After I fixed it, it seemed a bit unnatural so I just kept it like it was