aboutsummaryrefslogtreecommitdiff
path: root/game/missile/MissileScript.cpp
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-10 12:05:16 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-10 12:05:16 +0100
commit15a958a7f327bb2e81e7d445f1499ec78c7f5839 (patch)
tree335754f27b42f00353be643c2f01240ec7a2bcc4 /game/missile/MissileScript.cpp
parentd20b25828b53af170a6534263e8de114e7fac121 (diff)
alers scripts and quitscript with ESC key
Diffstat (limited to 'game/missile/MissileScript.cpp')
-rw-r--r--game/missile/MissileScript.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/game/missile/MissileScript.cpp b/game/missile/MissileScript.cpp
index 6d0e40e..2d1052e 100644
--- a/game/missile/MissileScript.cpp
+++ b/game/missile/MissileScript.cpp
@@ -1,6 +1,9 @@
#include "MissileScript.h"
#include "../Config.h"
+#include "Collider.h"
#include "api/BehaviorScript.h"
+#include "api/CircleCollider.h"
+#include "api/Rigidbody.h"
#include <crepe/api/Animator.h>
#include <crepe/api/AudioSource.h>
@@ -25,8 +28,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 +38,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 +51,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) {