Made simulation even more satisfying

main
Yan Wittmann 2023-03-25 18:27:54 +01:00
parent d8ed9dee24
commit 8cbf623247
3 changed files with 1 additions and 8 deletions

View File

@ -38,7 +38,7 @@ elif what_to_run == 'physics':
screen = pygame.display.set_mode((600, 500))
pygame.display.set_caption("PM GAME")
clock = pygame.time.Clock()
frame_rate = 60
frame_rate = 59.52
spritesheet_manager = SpritesheetManager("data/sprites", "data/sprites/sprites.json")

View File

@ -45,7 +45,6 @@ class PhysicsElementsHandler:
def attempt_move(self, dt: float, sprite: DynamicSprite, colliders: list[StaticSprite], motion_steps: int) -> bool:
total_motion = sprite.motion
motion_step = ((total_motion[0] * dt) / motion_steps, (total_motion[1] * dt) / motion_steps)
print(motion_step)
for i in range(motion_steps):
sprite.reset_touches()

View File

@ -39,12 +39,6 @@ class DynamicSprite(StaticSprite):
def tick(self, dt: float):
super().tick(dt)
# self.motion = (
# self.motion[0] - self.deceleration_horizontal * dt,
# self.motion[1] + self.gravity * dt
# )
# wrong implementation. Make deceleration_horizontal only until 0 is reached. multiply value with motion
deceleration_horizontal = 0
if abs(self.motion[0]) > 0:
if self.touches_bounding[2]: