#include "NpcScript.h" #include #include #include using namespace std; using namespace crepe; void NpcScript::fixed_update(duration_t dt) { auto & rb = this->get_component(); auto & npc = this->get_component(); auto & transform = this->get_component(); if (transform.position.x < 200) { rb.data.linear_velocity.x *= -1; } if (transform.position.x > 700) { rb.data.linear_velocity.x *= -1; } if (rb.data.linear_velocity.x < 0) { npc.data.flip = {true, false}; } else { npc.data.flip = {false, false}; } }