|
@@ -296,37 +296,13 @@ class Player(HandlerPlayerEvent, PlayerDisplay):
|
|
|
"""
|
|
"""
|
|
|
fonction qui déplace le player et applique donc la physique et les collisions avec les inputs
|
|
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
|
|
self.air_time += dt # update air time
|
|
|
# set states on ground
|
|
# set states on ground
|
|
|
if self.collide[self.gravity_orientation]:
|
|
if self.collide[self.gravity_orientation]:
|
|
|
self.air_time = 0
|
|
self.air_time = 0
|
|
|
self.is_jumping = False
|
|
self.is_jumping = False
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
if self.primary_anchor_pos != None and not self.swing:
|
|
if self.primary_anchor_pos != None and not self.swing:
|
|
|
self.rope_length = (self.primary_anchor_pos - self.get_center()).magnitude()
|
|
self.rope_length = (self.primary_anchor_pos - self.get_center()).magnitude()
|
|
|
|
|
|
|
@@ -346,8 +322,8 @@ class Player(HandlerPlayerEvent, PlayerDisplay):
|
|
|
set_swing(self, self.primary_anchor_pos, self.rope_length)
|
|
set_swing(self, self.primary_anchor_pos, self.rope_length)
|
|
|
else:
|
|
else:
|
|
|
update_swing(self, dt, map_manager)
|
|
update_swing(self, dt, map_manager)
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def update(self, dt: float, map_manager: MapManager) -> None:
|
|
def update(self, dt: float, map_manager: MapManager) -> None:
|
|
|
"""
|
|
"""
|
|
|
Called every frame by the main loop
|
|
Called every frame by the main loop
|