From d544c5a57db9c76deedc0b89a7158ec073eca108 Mon Sep 17 00:00:00 2001 From: Tipragot Date: Sun, 29 Oct 2023 16:46:22 +0100 Subject: [PATCH] Better calculs --- src/plugins/smooth.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/smooth.py b/src/plugins/smooth.py index f74e604..6858b2d 100644 --- a/src/plugins/smooth.py +++ b/src/plugins/smooth.py @@ -2,7 +2,6 @@ Un plugin permettant de faire des déplacements fluides des entités. """ -import math from engine import Delta, Position, Scene, Vec2, World @@ -25,9 +24,10 @@ def __update_positions(world: World): for entity in world.query(Position, Target): position = entity[Position] target = entity[Target] - speed = entity[Speed] if Speed in entity else Speed(500) - blend = math.pow(0.5, world[Delta] * speed) - entity[Position] = Position(position + ((target - position) * blend)) + speed = entity[Speed] if Speed in entity else Speed(5) + entity[Position] = Position( + position + (target - position) * world[Delta] * speed + ) PLUGIN = Scene(