From 4a435b8fe98c5db1ecd95619997af10146135e85 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Thu, 9 Jan 2025 17:33:00 +0100 Subject: improve player responsiveness --- game/player/PlayerScript.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'game/player/PlayerScript.h') diff --git a/game/player/PlayerScript.h b/game/player/PlayerScript.h index e7d860a..6875b05 100644 --- a/game/player/PlayerScript.h +++ b/game/player/PlayerScript.h @@ -1,8 +1,11 @@ #pragma once +#include "util/OptionalRef.h" #include +#include #include #include + 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; @@ -19,4 +25,7 @@ private: std::chrono::duration shot_delay = std::chrono::duration(0.5); int current_jetpack_sound = 0; + + float & engine_gravity = crepe::Config::get_instance().physics.gravity; + crepe::OptionalRef body; }; -- cgit v1.2.3