From bcf57e81f68913049f84cabb66871931c8f47b2b Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Fri, 22 Nov 2024 16:11:39 +0100 Subject: script fix --- src/example/game.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/example') diff --git a/src/example/game.cpp b/src/example/game.cpp index f6b580a..991d2ec 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -17,12 +17,14 @@ using namespace crepe; using namespace std; class MyScript : public Script { - static bool oncollision(const CollisionEvent& test) { + bool oncollision(const CollisionEvent& test) { Log::logf("Box {} script on_collision()", test.info.first.collider.game_object_id); return true; } void init() { - EventManager::get_instance().subscribe(oncollision, 0); + subscribe([this](const CollisionEvent& ev) -> bool { + return this->oncollision(ev); + }); } void update() { // Retrieve component from the same GameObject this script is on -- cgit v1.2.3