From 067aa2536f9f43d07e22696c618258a26ae928b3 Mon Sep 17 00:00:00 2001 From: max-001 Date: Thu, 19 Dec 2024 11:09:26 +0100 Subject: Moved PlayerScript to seperate file --- src/example/PlayerSubScene.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'src/example/PlayerSubScene.cpp') diff --git a/src/example/PlayerSubScene.cpp b/src/example/PlayerSubScene.cpp index 180ca17..7d9526b 100644 --- a/src/example/PlayerSubScene.cpp +++ b/src/example/PlayerSubScene.cpp @@ -1,4 +1,5 @@ #include "PlayerSubScene.h" +#include "PlayerScript.h" #include #include @@ -9,14 +10,6 @@ using namespace crepe; using namespace std; -class PlayerScript : public Script { -public: - void update() { - Rigidbody & rb = this->get_components_by_name("player").front(); - if (this->get_key_state(Keycode::SPACE)) rb.add_force_linear(vec2(0, -10)); - } -}; - PlayerSubScene::PlayerSubScene(Scene & scn) { GameObject player = scn.new_object("player", "player", vec2(-100, 200)); Asset player_body_asset{"asset/jetpack_joyride/barry/defaultBody.png"}; -- cgit v1.2.3