Here's the problem:
I noticed that the jumping isn't consistent. Sometimes it jumps a bit more than others or a bit less. Which is very troublesome in a platformer game. I'm not sure if my implementation is wrong, or If I need to do something more in order to get past this, or simply using dt for movement in platformers isn't ideal in general.
This is my code for the player class:
Code: Select all
self.vspeed = self.vspeed + self.gravity --adds gravity every step
self.dx = self.x
self.dy = self.y
self.x = self.x + self.hspeed*dt
self.y = self.y + self.vspeed*dt --changes the position of the character
*I searched the forums but i couldn't find anything, perhaps I'm bad at searching tho :S*