aboutsummaryrefslogtreecommitdiff
path: root/src/example/PlayerSubScene.cpp
diff options
context:
space:
mode:
authormax-001 <maxsmits21@kpnmail.nl>2024-12-19 11:09:26 +0100
committermax-001 <maxsmits21@kpnmail.nl>2024-12-19 11:09:26 +0100
commit067aa2536f9f43d07e22696c618258a26ae928b3 (patch)
treee9e641ab28cfd8163acee1596d9d07dd339d969a /src/example/PlayerSubScene.cpp
parent1e6aaf13f4ecdc67e75eb26bcd8a6f0059c5cfe9 (diff)
Moved PlayerScript to seperate file
Diffstat (limited to 'src/example/PlayerSubScene.cpp')
-rw-r--r--src/example/PlayerSubScene.cpp9
1 files changed, 1 insertions, 8 deletions
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 <crepe/api/Animator.h>
#include <crepe/api/GameObject.h>
@@ -9,14 +10,6 @@
using namespace crepe;
using namespace std;
-class PlayerScript : public Script {
-public:
- void update() {
- Rigidbody & rb = this->get_components_by_name<Rigidbody>("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"};