Skip to content

Commit

Permalink
Moved moving platforms code (#1759)
Browse files Browse the repository at this point in the history
* Moved moving platforms code

Move the moving platforms before moving the player. That way, the player's movement is up to date with the platform's position.

* Update physics_engines.py

---------

Co-authored-by: Einar Forselv <eforselv@gmail.com>
  • Loading branch information
cacheguy and einarf committed Jun 9, 2023
1 parent c836a53 commit b9cbb2d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arcade/physics_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,6 @@ def update(self):

# print(f"Spot B ({self.player_sprite.center_x}, {self.player_sprite.center_y})")

complete_hit_list = _move_sprite(self.player_sprite, self.walls + self.platforms, ramp_up=True)

for platform_list in self.platforms:
for platform in platform_list:
if platform.change_x != 0 or platform.change_y != 0:
Expand Down Expand Up @@ -433,6 +431,8 @@ def update(self):

platform.center_y += platform.change_y

complete_hit_list = _move_sprite(self.player_sprite, self.walls + self.platforms, ramp_up=True)

# print(f"Spot Z ({self.player_sprite.center_x}, {self.player_sprite.center_y})")
# Return list of encountered sprites
# end_time = time.time()
Expand Down

0 comments on commit b9cbb2d

Please sign in to comment.