diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-10 10:19:10 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2025-01-10 10:19:10 +0100 |
commit | 1de7cd3a1265edd2c247f5f847a5665bafd78faa (patch) | |
tree | 3ffe29af85853ce240806f6a86e3e1742301e3f7 /game/player/PlayerScript.h | |
parent | cb17c2aad3ca8c89d0f6d8305ba4f3a5c3c2a971 (diff) | |
parent | d20b25828b53af170a6534263e8de114e7fac121 (diff) |
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/game-improvements
Diffstat (limited to 'game/player/PlayerScript.h')
-rw-r--r-- | game/player/PlayerScript.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/game/player/PlayerScript.h b/game/player/PlayerScript.h index 0b77caa..6a7dedb 100644 --- a/game/player/PlayerScript.h +++ b/game/player/PlayerScript.h @@ -1,8 +1,11 @@ #pragma once +#include "util/OptionalRef.h" #include <chrono> +#include <crepe/api/Config.h> #include <crepe/api/Event.h> #include <crepe/api/Script.h> + class PlayerScript : public crepe::Script { public: void init(); @@ -10,8 +13,11 @@ public: private: bool on_collision(const crepe::CollisionEvent & ev); + bool on_key_down(const crepe::KeyPressEvent & ev); + bool on_key_up(const crepe::KeyReleaseEvent & ev); // bool on_key_up(const crepe::KeyReleaseEvent& ev); void shoot(const crepe::vec2 & location, float angle); + void help_kick(const crepe::vec2 & direction); private: int prev_anim = 0; @@ -20,4 +26,7 @@ private: std::chrono::duration<float> shot_delay = std::chrono::duration<float>(0.5); std::chrono::duration<float> switch_delay = std::chrono::duration<float>(0.01); int current_jetpack_sound = 0; + + float & engine_gravity = crepe::Config::get_instance().physics.gravity; + crepe::OptionalRef<crepe::Rigidbody> body; }; |