diff options
author | Max-001 <80035972+Max-001@users.noreply.github.com> | 2025-01-11 16:17:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-01-11 16:17:01 +0100 |
commit | b6609ecd6636e65db76eb11617923222921d52d2 (patch) | |
tree | 29f227815f9bd073d0497e54da57f5aa08a385cc /game/preview/NpcScript.cpp | |
parent | 525636bb2158ecea68ebb9d6b8d2dc722524c5e5 (diff) | |
parent | d61c207995693a21dd224f70bc7e7ead492c849b (diff) |
Merge pull request #133 from lonkaars/max/preview
Max/preview
Diffstat (limited to 'game/preview/NpcScript.cpp')
-rw-r--r-- | game/preview/NpcScript.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/game/preview/NpcScript.cpp b/game/preview/NpcScript.cpp index 5a93c2b..86117d4 100644 --- a/game/preview/NpcScript.cpp +++ b/game/preview/NpcScript.cpp @@ -9,7 +9,7 @@ using namespace crepe; void NpcScript::fixed_update(duration_t dt) { auto & rb = this->get_component<Rigidbody>(); - auto & npc = this->get_component<Sprite>(); + auto npc = this->get_components<Sprite>(); auto & transform = this->get_component<Transform>(); if (transform.position.x < 200) { @@ -20,8 +20,10 @@ void NpcScript::fixed_update(duration_t dt) { } if (rb.data.linear_velocity.x < 0) { - npc.data.flip = {true, false}; + npc.front().get().data.flip = {true, false}; + npc.back().get().data.flip = {true, false}; } else { - npc.data.flip = {false, false}; + npc.front().get().data.flip = {false, false}; + npc.back().get().data.flip = {false, false}; } } |