diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2024-12-24 12:14:51 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2024-12-24 12:14:51 +0100 |
commit | a0a3e7e2d12d3acb7bf4073cb5a10c08047cd08e (patch) | |
tree | 063137e04def88c0b3bb7404cf7630881a9c2f3e /game/player | |
parent | 192aea3112af0b36f6f26670e66c7e24926c579a (diff) |
Added EndGameScript
Diffstat (limited to 'game/player')
-rw-r--r-- | game/player/PlayerScript.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp index 1a5d497..de53fc7 100644 --- a/game/player/PlayerScript.cpp +++ b/game/player/PlayerScript.cpp @@ -1,4 +1,5 @@ #include "PlayerScript.h" +#include "api/BehaviorScript.h" #include <crepe/api/Animator.h> #include <crepe/api/ParticleEmitter.h> @@ -17,6 +18,8 @@ void PlayerScript::init() { bool PlayerScript::on_collision(const CollisionEvent & ev) { BehaviorScript & play_scr = this->get_components_by_name<BehaviorScript>("player").front(); + BehaviorScript & end_scr + = this->get_components_by_name<BehaviorScript>("end_game_script").front(); RefVector<Animator> animators = this->get_components_by_name<Animator>("player"); RefVector<ParticleEmitter> emitters = this->get_components_by_name<ParticleEmitter>("player"); @@ -32,6 +35,7 @@ bool PlayerScript::on_collision(const CollisionEvent & ev) { emitter.data.emission_rate = 0; } play_scr.active = false; + end_scr.active = true; return true; } else if (ev.info.other.metadata.tag == "laser") { for (Animator & anim : animators) { @@ -44,6 +48,7 @@ bool PlayerScript::on_collision(const CollisionEvent & ev) { emitter.data.emission_rate = 0; } play_scr.active = false; + end_scr.active = true; return true; } else if (ev.info.other.metadata.tag == "missile") { for (Animator & anim : animators) { @@ -56,6 +61,7 @@ bool PlayerScript::on_collision(const CollisionEvent & ev) { emitter.data.emission_rate = 0; } play_scr.active = false; + end_scr.active = true; return true; } |