So I’m having some troubles with my gravity system…
Right now, this is my code
def upt_gravity(self, task): if self.turn: self.player.setZ(max(self.player.getZ() + self.zSpeed * self.dt, -900)) print self.player.getZ(), self.zSpeed if self.keys['space'] == True: self.turn = False self.player.setZ(max(self.player.getZ() - self.zSpeed * self.dt, -900)) return task.cont
this code just makes my player fall down and whenever I press space bar, it goes up until I let go of my space bar.
What I want to know is that how do I make my player go up and comes down whenever I press space bar?
Also, I would like to know how to put an acceleration to my jump. Thanks.