diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-10 16:26:05 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-10 16:26:05 +0100 |
commit | a981a42a7378ed51155590215557e52553031272 (patch) | |
tree | 7ca1b0cb7f72d6e8d50df09470a177a09ee12e51 /game/missile/MissileScript.cpp | |
parent | 0f8bf257d86b5532f3d6f559e5368668c255af7c (diff) |
missile solution, cannot find @max issue
Diffstat (limited to 'game/missile/MissileScript.cpp')
-rw-r--r-- | game/missile/MissileScript.cpp | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/game/missile/MissileScript.cpp b/game/missile/MissileScript.cpp index bcc4f5b..f87dd20 100644 --- a/game/missile/MissileScript.cpp +++ b/game/missile/MissileScript.cpp @@ -27,7 +27,6 @@ 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>().front().get(); animations[0].get().active = false; @@ -36,11 +35,10 @@ 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; - - fly_sound.stop(); } void MissileScript::activate() { auto anim = this->get_components<Animator>(); @@ -49,14 +47,10 @@ 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) { auto & explosion_sound = this->get_components<AudioSource>().back().get(); @@ -79,6 +73,7 @@ void MissileScript::fixed_update(crepe::duration_t dt) { const auto & cam = this->get_components_by_name<Transform>("camera").front().get(); const auto & velocity = this->get_component<Rigidbody>().data.linear_velocity; + if (missile.position.x < (cam.position.x - VIEWPORT_X / 1.8)) { this->kill_missile(); return; |