Rebonk sur le plafond

This commit is contained in:
theo@manjaro 2021-07-01 21:49:03 +02:00
parent 4d89036f66
commit a1cbe26892

View File

@ -37,6 +37,8 @@ class Player(BaseObject):
else: else:
self.vertical+=self.gravity*self.game.dt self.vertical+=self.gravity*self.game.dt
self.vertical = min(self.maxgravity,self.vertical) self.vertical = min(self.maxgravity,self.vertical)
if self.checkcollisions(0,-1):
self.vertical = max(0,self.vertical) # Se cogne au plafond
self.jumped = False self.jumped = False
if self.onground: if self.onground:
@ -45,8 +47,6 @@ class Player(BaseObject):
self.jumped = True self.jumped = True
self.move(hor*self.speed*self.game.dt,self.vertical*self.game.dt) self.move(hor*self.speed*self.game.dt,self.vertical*self.game.dt)
if self.jumped:
print(self.vertical*self.game.dt)
def getrects(self): def getrects(self):
result = [] result = []