From: LMH Date: Mon, 2 Sep 2013 17:59:33 +0000 (-1000) Subject: Improved death mechanics of flame and iceflame. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=44713dee898a19130b162174a10e7b3b42697a1a;p=supertux.git Improved death mechanics of flame and iceflame. These enemies no longer hurt Tux or can take additional hits while their death animations are playing. --- diff --git a/src/badguy/flame.cpp b/src/badguy/flame.cpp index d061f676f..705344cf8 100644 --- a/src/badguy/flame.cpp +++ b/src/badguy/flame.cpp @@ -34,7 +34,6 @@ Flame::Flame(const Reader& reader) : angle(0), radius(100), speed(2), - fading(false), light(0.0f,0.0f,0.0f), lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")), sound_source() @@ -61,9 +60,8 @@ Flame::active_update(float elapsed_time) movement = newpos - get_pos(); sound_source->set_position(get_pos()); - - if(fading) - if (sprite->animation_done()) remove_me(); + + if (sprite->get_action() == "fade" && sprite->animation_done()) remove_me(); } void @@ -113,11 +111,8 @@ Flame::freeze() //TODO: get unique death sound sound_manager->play("sounds/fizz.wav", get_pos()); sprite->set_action("fade", 1); - Vector ppos = bbox.get_middle(); - Vector pspeed = Vector(0, -150); - Vector paccel = Vector(0,0); - Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2)); - fading = true; + Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", bbox.get_middle(), ANCHOR_MIDDLE, Vector(0, -150), Vector(0,0), LAYER_BACKGROUNDTILES+2)); + set_group(COLGROUP_DISABLED); // start dead-script run_dead_script(); diff --git a/src/badguy/flame.hpp b/src/badguy/flame.hpp index 4e5abd032..651367489 100644 --- a/src/badguy/flame.hpp +++ b/src/badguy/flame.hpp @@ -41,7 +41,6 @@ private: float angle; float radius; float speed; - bool fading; Color light; SpritePtr lightsprite; diff --git a/src/badguy/iceflame.cpp b/src/badguy/iceflame.cpp index 1ff3ea70d..2de434d28 100644 --- a/src/badguy/iceflame.cpp +++ b/src/badguy/iceflame.cpp @@ -32,7 +32,6 @@ Iceflame::Iceflame(const Reader& reader) : angle(0), radius(100), speed(2), - fading(false), light(0.0f,0.0f,0.0f), lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")) { @@ -59,8 +58,7 @@ Iceflame::active_update(float elapsed_time) start_position.y + sin(angle) * radius); movement = newpos - get_pos(); - if(fading) - if (sprite->animation_done()) remove_me(); + if (sprite->get_action() == "fade" && sprite->animation_done()) remove_me(); } void @@ -91,12 +89,9 @@ Iceflame::ignite() { sound_manager->play("sounds/fizz.wav", get_pos()); sprite->set_action("fade", 1); - Vector ppos = bbox.get_middle(); - Vector pspeed = Vector(0, -150); - Vector paccel = Vector(0,0); - Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2)); - fading = true; - + Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", bbox.get_middle(), ANCHOR_MIDDLE, Vector(0, -150), Vector(0,0), LAYER_BACKGROUNDTILES+2)); + set_group(COLGROUP_DISABLED); + // start dead-script run_dead_script(); } diff --git a/src/badguy/iceflame.hpp b/src/badguy/iceflame.hpp index 9f1d8bccf..d2632c902 100644 --- a/src/badguy/iceflame.hpp +++ b/src/badguy/iceflame.hpp @@ -36,7 +36,6 @@ private: float angle; float radius; float speed; - bool fading; Color light; SpritePtr lightsprite;