aboutsummaryrefslogtreecommitdiff
path: root/game/enemy/EnemyScript.h
diff options
context:
space:
mode:
authorWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-08 12:17:30 +0100
committerWBoerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-08 12:17:30 +0100
commit1a5744a3285a5ba5132fb4f6f031c27df1b64d33 (patch)
treee1a893eadc08da75910cd4a4e4608959bffde1b7 /game/enemy/EnemyScript.h
parent49f0f0a24c1557a90530e0d2e0160e221644728a (diff)
enemy death working
Diffstat (limited to 'game/enemy/EnemyScript.h')
-rw-r--r--game/enemy/EnemyScript.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/game/enemy/EnemyScript.h b/game/enemy/EnemyScript.h
index 35d2626..7babe4d 100644
--- a/game/enemy/EnemyScript.h
+++ b/game/enemy/EnemyScript.h
@@ -15,16 +15,17 @@ class EnemyScript : public crepe::Script {
void init() override;
void fixed_update(crepe::duration_t dt) override;
void shoot(const crepe::vec2& position,float angle);
- void onCollide(const crepe::CollisionEvent & collisionData);
+ bool on_collide(const crepe::CollisionEvent & collisionData);
+ void despawn_enemy();
bool spawn_enemy(const SpawnEnemyEvent& e);
private:
std::random_device rd;
std::default_random_engine engine;
-
+ bool alive = false;
float speed = 50;
const float MIN_SPEED = 10;
const float MAX_SPEED = 130;
const float MAX_DISTANCE = 100;
std::chrono::time_point<std::chrono::steady_clock> last_fired;
- std::chrono::duration<float> shot_delay;
+ std::chrono::duration<float> shot_delay = std::chrono::duration<float>(0);
};