diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-11 11:21:17 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-11 11:21:17 +0100 |
commit | 2bc23c83489fe45af207559cbb8620b97fc73b35 (patch) | |
tree | 11e2ddfe011464d19ed3c355e028648c4abebd05 /game/preview/NpcScript.cpp | |
parent | 459044947bea485c4e006a62af0f5af0b7190d9d (diff) |
Fix: Invert both body and head of NPC sprite
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}; } } |