diff options
author | max-001 <maxsmits21@kpnmail.nl> | 2024-12-19 11:09:26 +0100 |
---|---|---|
committer | max-001 <maxsmits21@kpnmail.nl> | 2024-12-19 11:09:26 +0100 |
commit | 067aa2536f9f43d07e22696c618258a26ae928b3 (patch) | |
tree | e9e641ab28cfd8163acee1596d9d07dd339d969a /src/example/PlayerScript.cpp | |
parent | 1e6aaf13f4ecdc67e75eb26bcd8a6f0059c5cfe9 (diff) |
Moved PlayerScript to seperate file
Diffstat (limited to 'src/example/PlayerScript.cpp')
-rw-r--r-- | src/example/PlayerScript.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/example/PlayerScript.cpp b/src/example/PlayerScript.cpp new file mode 100644 index 0000000..a147e06 --- /dev/null +++ b/src/example/PlayerScript.cpp @@ -0,0 +1,11 @@ +#include "PlayerScript.h" + +#include <crepe/api/Rigidbody.h> + +using namespace crepe; +using namespace std; + +void PlayerScript::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)); +} |