Player jumping increases with speed

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
lieudusty
Prole
Posts: 14
Joined: Thu Feb 21, 2013 5:19 am

Player jumping increases with speed

Post by lieudusty »

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?

Thanks in advanced for the help! :)
Attachments
SideJump.love
(186.41 KiB) Downloaded 151 times
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Player jumping increases with speed

Post by Davidobot »

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
lieudusty
Prole
Posts: 14
Joined: Thu Feb 21, 2013 5:19 am

Re: Player jumping increases with speed

Post by lieudusty »

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.
User avatar
Davidobot
Party member
Posts: 1226
Joined: Sat Mar 31, 2012 5:18 am
Location: Oxford, UK
Contact:

Re: Player jumping increases with speed

Post by Davidobot »

lieudusty wrote:
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
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Player jumping increases with speed

Post by micha »

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.
lieudusty
Prole
Posts: 14
Joined: Thu Feb 21, 2013 5:19 am

Re: Player jumping increases with speed

Post by lieudusty »

Davidobot wrote:
lieudusty wrote:
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! :)
lieudusty
Prole
Posts: 14
Joined: Thu Feb 21, 2013 5:19 am

Re: Player jumping increases with speed

Post by lieudusty »

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 :)
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Shadezy and 6 guests