Gameplay de la recherche dans les dossiers #44
|
@ -2,7 +2,6 @@
|
||||||
Un plugin permettant de faire des déplacements fluides des entités.
|
Un plugin permettant de faire des déplacements fluides des entités.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import math
|
|
||||||
from engine import Delta, Position, Scene, Vec2, World
|
from engine import Delta, Position, Scene, Vec2, World
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,9 +24,10 @@ def __update_positions(world: World):
|
||||||
for entity in world.query(Position, Target):
|
for entity in world.query(Position, Target):
|
||||||
position = entity[Position]
|
position = entity[Position]
|
||||||
target = entity[Target]
|
target = entity[Target]
|
||||||
speed = entity[Speed] if Speed in entity else Speed(500)
|
speed = entity[Speed] if Speed in entity else Speed(5)
|
||||||
blend = math.pow(0.5, world[Delta] * speed)
|
entity[Position] = Position(
|
||||||
entity[Position] = Position(position + ((target - position) * blend))
|
position + (target - position) * world[Delta] * speed
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
PLUGIN = Scene(
|
PLUGIN = Scene(
|
||||||
|
|
Loading…
Reference in a new issue