aboutsummaryrefslogtreecommitdiff
path: root/game/missile/MissileScript.cpp
diff options
context:
space:
mode:
authorheavydemon21 <48092678+heavydemon21@users.noreply.github.com>2025-01-10 14:44:59 +0100
committerGitHub <noreply@github.com>2025-01-10 14:44:59 +0100
commit798237b661e8e49284e78ffb1a16599cf6a46a6d (patch)
tree8f4881cf4abc58774625383620cf82fa55b9d1f0 /game/missile/MissileScript.cpp
parentbb2db93bfb8dd7e080d2708548eae660e6b33913 (diff)
parentd1cebcca2018ed4ef47ad125e45aafd018a2ab2e (diff)
Merge pull request #125 from lonkaars/niels/game
missile alerts
Diffstat (limited to 'game/missile/MissileScript.cpp')
-rw-r--r--game/missile/MissileScript.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/game/missile/MissileScript.cpp b/game/missile/MissileScript.cpp
index 6d0e40e..bcc4f5b 100644
--- a/game/missile/MissileScript.cpp
+++ b/game/missile/MissileScript.cpp
@@ -1,18 +1,19 @@
#include "MissileScript.h"
#include "../Config.h"
-#include "api/BehaviorScript.h"
+#include <cmath>
+#include <crepe/api/AI.h>
#include <crepe/api/Animator.h>
#include <crepe/api/AudioSource.h>
+#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/CircleCollider.h>
+#include <crepe/api/KeyCodes.h>
+#include <crepe/api/Rigidbody.h>
+#include <crepe/api/Sprite.h>
#include <crepe/api/Transform.h>
#include <crepe/system/CollisionSystem.h>
#include <crepe/types.h>
-#include <cmath>
-#include <crepe/api/AI.h>
-#include <crepe/api/KeyCodes.h>
-#include <crepe/api/Sprite.h>
-
using namespace std;
using namespace crepe;
@@ -25,8 +26,9 @@ void MissileScript::init() {
void MissileScript::kill_missile() {
auto animations = this->get_components<Animator>();
auto sprites = this->get_components<Sprite>();
+ auto collider = this->get_component<CircleCollider>();
auto & fly_sound = this->get_components<AudioSource>().front().get();
- auto & this_script = this->get_components<BehaviorScript>().back().get();
+ auto & this_script = this->get_components<BehaviorScript>().front().get();
animations[0].get().active = false;
animations[1].get().active = false;
@@ -34,7 +36,7 @@ void MissileScript::kill_missile() {
sprites[0].get().active = false;
sprites[1].get().active = false;
sprites[2].get().active = true;
-
+ collider.active = false;
this_script.active = false;
this->seeking_disabled = false;
@@ -47,9 +49,12 @@ void MissileScript::activate() {
anim[0].get().active = true;
anim[1].get().active = true;
anim[2].get().stop();
+ //anim[3].get().active = true;
+
sprites[0].get().active = true;
sprites[1].get().active = true;
sprites[2].get().active = false;
+ //sprites[3].get().active = true;
}
bool MissileScript::on_collision(const CollisionEvent & ev) {