Skip to content

Commit

Permalink
Improved death mechanics of flame and iceflame.
Browse files Browse the repository at this point in the history
These enemies no longer hurt Tux or can take additional hits while their death animations are playing.
  • Loading branch information
LMH0013 authored and tobbi committed Oct 26, 2013
1 parent e62cb44 commit c52b9f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 20 deletions.
13 changes: 4 additions & 9 deletions src/badguy/flame.cpp
Expand Up @@ -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()
Expand All @@ -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
Expand Down Expand Up @@ -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();
Expand Down
1 change: 0 additions & 1 deletion src/badguy/flame.hpp
Expand Up @@ -41,7 +41,6 @@ class Flame : public BadGuy
float angle;
float radius;
float speed;
bool fading;
Color light;
SpritePtr lightsprite;

Expand Down
13 changes: 4 additions & 9 deletions src/badguy/iceflame.cpp
Expand Up @@ -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"))
{
Expand All @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down
1 change: 0 additions & 1 deletion src/badguy/iceflame.hpp
Expand Up @@ -36,7 +36,6 @@ class Iceflame : public BadGuy
float angle;
float radius;
float speed;
bool fading;
Color light;
SpritePtr lightsprite;

Expand Down

0 comments on commit c52b9f5

Please sign in to comment.