From bf17782e372142850e1d82965200509a7fa17ab6 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sun, 7 Jan 2024 09:26:21 +0000 Subject: [PATCH] =?UTF-8?q?R=C3=A9glage=20de=20la=20vibration=20du=20bot?= =?UTF-8?q?=20lorsqu'il=20y=20a=20peu=20de=20FPS=20(#15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-on: https://git.tipragot.fr/raphael/ponguito/pulls/15 Reviewed-by: Corentin Co-authored-by: Tipragot Co-committed-by: Tipragot --- src/scenes/game.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/scenes/game.py b/src/scenes/game.py index 8eefe9a..258f6a6 100644 --- a/src/scenes/game.py +++ b/src/scenes/game.py @@ -567,8 +567,10 @@ def _update_bot(world: World): # On se déplace vers la meilleure option diff = target - bot[Position].y - if abs(diff) > 10: + if abs(diff) > bot[Speed] * world[Delta]: bot[Position].y += (diff / abs(diff)) * bot[Speed] * world[Delta] + else: + bot[Position].y = target # On restrict l'entité a la scène __restrict_to_scene(world)