Improved death mechanics of flame and iceflame.
authorLMH <lmh.0013@gmail.com>
Mon, 2 Sep 2013 17:59:33 +0000 (07:59 -1000)
committerTobias Markus <tobbi@mozilla-uk.org>
Sat, 26 Oct 2013 16:45:20 +0000 (18:45 +0200)
These enemies no longer hurt Tux or can take additional hits while their death animations are playing.

src/badguy/flame.cpp
src/badguy/flame.hpp
src/badguy/iceflame.cpp
src/badguy/iceflame.hpp

index d061f67..705344c 100644 (file)
@@ -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();
index 4e5abd0..6513674 100644 (file)
@@ -41,7 +41,6 @@ private:
   float angle;
   float radius;
   float speed;
-  bool fading;
   Color light;
   SpritePtr lightsprite;
 
index 1ff3ea7..2de434d 100644 (file)
@@ -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();
 }
index 9f1d8bc..d2632c9 100644 (file)
@@ -36,7 +36,6 @@ private:
   float angle;
   float radius;
   float speed;
-  bool fading;
   Color light;
   SpritePtr lightsprite;