|
|
@@ -296,6 +296,31 @@ class Player(HandlerPlayerEvent, PlayerDisplay):
|
|
|
"""
|
|
|
fonction qui déplace le player et applique donc la physique et les collisions avec les inputs
|
|
|
"""
|
|
|
+
|
|
|
+ # On change les axes si la gravité n'est pas vers la bas
|
|
|
+ if self.gravity_orientation == Gravity.LEFT:
|
|
|
+ if self.velocity.y != 0:
|
|
|
+ self.x_velocity = self.velocity.y
|
|
|
+ if self.velocity.x != 0:
|
|
|
+ self.y_velocity = -self.velocity.x
|
|
|
+
|
|
|
+ elif self.gravity_orientation == Gravity.UP:
|
|
|
+ if self.velocity.x != 0:
|
|
|
+ self.x_velocity = -self.velocity.x
|
|
|
+ if self.velocity.y != 0:
|
|
|
+ self.y_velocity = -self.velocity.y
|
|
|
+
|
|
|
+ elif self.gravity_orientation == Gravity.RIGHT:
|
|
|
+ if self.velocity.y != 0:
|
|
|
+ self.x_velocity = -self.velocity.y
|
|
|
+ if self.velocity.x != 0:
|
|
|
+ self.y_velocity = self.velocity.x
|
|
|
+ else:
|
|
|
+ if self.velocity.x != 0:
|
|
|
+ self.x_velocity = self.velocity.x
|
|
|
+ if self.velocity.y != 0:
|
|
|
+ self.y_velocity = self.velocity.y
|
|
|
+
|
|
|
self.air_time += dt # update air time
|
|
|
# set states on ground
|
|
|
if self.collide[self.gravity_orientation]:
|
|
|
@@ -321,7 +346,8 @@ class Player(HandlerPlayerEvent, PlayerDisplay):
|
|
|
set_swing(self, self.primary_anchor_pos, self.rope_length)
|
|
|
else:
|
|
|
update_swing(self, dt, map_manager)
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
def update(self, dt: float, map_manager: MapManager) -> None:
|
|
|
"""
|
|
|
Called every frame by the main loop
|