From 2bc23c83489fe45af207559cbb8620b97fc73b35 Mon Sep 17 00:00:00 2001 From: Max-001 Date: Sat, 11 Jan 2025 11:21:17 +0100 Subject: Fix: Invert both body and head of NPC sprite --- game/preview/NpcScript.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'game/preview/NpcScript.cpp') 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(); - auto & npc = this->get_component(); + auto npc = this->get_components(); auto & transform = this->get_component(); 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}; } } -- cgit v1.2.3