summary refs log tree commit diff stats
path: root/src/behaviour_system.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/behaviour_system.cpp')
-rw-r--r--src/behaviour_system.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/behaviour_system.cpp b/src/behaviour_system.cpp index a05912c..b68cd6d 100644 --- a/src/behaviour_system.cpp +++ b/src/behaviour_system.cpp
@@ -40,6 +40,21 @@ void BehaviourSystem::tick(double dt) {
40 } 40 }
41 } 41 }
42 42
43 overcorrectionTimer_.accumulate(dt);
44 while (overcorrectionTimer_.step()) {
45 for (int spriteId : game_.getSprites()) {
46 Sprite& sprite = game_.getSprite(spriteId);
47 if (!sprite.paused &&
48 sprite.behaviourType == BehaviourType::Path &&
49 !sprite.path.empty() &&
50 sprite.loc != sprite.path.front().endpoint) {
51 if (directionFacingPoint(sprite.path.front().endpoint - sprite.loc) != sprite.path.front().dir) {
52 game_.getSystem<TransformSystem>().moveSprite(spriteId, sprite.path.front().endpoint);
53 }
54 }
55 }
56 }
57
43 for (int spriteId : game_.getSprites()) { 58 for (int spriteId : game_.getSprites()) {
44 Sprite& sprite = game_.getSprite(spriteId); 59 Sprite& sprite = game_.getSprite(spriteId);
45 if (!sprite.paused && sprite.behaviourType == BehaviourType::Path) { 60 if (!sprite.paused && sprite.behaviourType == BehaviourType::Path) {