From a0d25c9768e62912928a9ec6ef254b346ee8f27b Mon Sep 17 00:00:00 2001 From: popkex Date: Mon, 29 Jun 2026 13:34:52 +0200 Subject: [PATCH] =?UTF-8?q?-=20correction=20du=20d=C3=A9placement=20de=20l?= =?UTF-8?q?a=20balle=20+=20joueur=20(utilisation=20du=20dt)=20-=20=20modif?= =?UTF-8?q?ication=20todo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ball.py | 4 ++-- src/main.py | 2 +- src/player.py | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ball.py b/src/ball.py index 7d44877..71a2d49 100644 --- a/src/ball.py +++ b/src/ball.py @@ -73,8 +73,8 @@ class Ball(Entity): else: self.collide = False - self.pos.x += round(self.velocity.x) - self.pos.y += round(self.velocity.y) + self.pos.x += self.velocity.x * deltatime * 100 + self.pos.y += self.velocity.y * deltatime * 100 def as_winner(self) -> int: if (self.pos.y < 0): return 0 # Joueur a gagner diff --git a/src/main.py b/src/main.py index aa04832..7bc96f4 100644 --- a/src/main.py +++ b/src/main.py @@ -1,6 +1,6 @@ """ TODO - - modifier déplacement joueur & balle pour utiliser le deltatime + - orriger collision - faire un menu style arcade - rendre le jeu plus arcade - ajouter des sons style arcade diff --git a/src/player.py b/src/player.py index c025686..2bc1967 100644 --- a/src/player.py +++ b/src/player.py @@ -40,8 +40,8 @@ class Player(Entity): self.apply_friction(deltatime) temps_pos: Tuple[float, float] = ( - self.pos.x + self.velocity.x, - self.pos.y + self.velocity.y + self.pos.x + self.velocity.x * deltatime * 100, + self.pos.y + self.velocity.y * deltatime * 100 ) # les collisions