From 310a1cefc85eebc3b31651dbc185abb41e37fb32 Mon Sep 17 00:00:00 2001 From: Ryan Flegel Date: Fri, 28 May 2004 19:47:16 +0000 Subject: [PATCH] - made bombs explode instantly when they run into an exploding bomb (from Ricardo) - only flip death animations when y-velocity is negative SVN-Revision: 1353 --- src/badguy.cpp | 18 ++++++++++++------ src/badguy.h | 3 ++- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/badguy.cpp b/src/badguy.cpp index 09adc6dee..c075dd1ad 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -996,7 +996,7 @@ BadGuy::draw(Camera& viewport, int) } Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right; - if(dying == DYING_FALLING) + if(dying == DYING_FALLING && physic.get_velocity_y() < 0) sprite->draw(viewport.world2screen(Vector(base.x, base.y)), SD_VERTICAL_FLIP); else sprite->draw(viewport.world2screen(Vector(base.x, base.y))); @@ -1080,7 +1080,7 @@ BadGuy::squish(Player* player) if(kind == BAD_MRBOMB) { // mrbomb transforms into a bomb now - explode(); + explode(false); make_player_jump(player); World::current()->add_score(Vector(base.x, base.y), @@ -1206,9 +1206,15 @@ BadGuy::kill_me(int score) } void -BadGuy::explode() +BadGuy::explode(bool right_way) { - World::current()->add_bad_guy(base.x, base.y, BAD_BOMB); + BadGuy *badguy = World::current()->add_bad_guy(base.x, base.y, BAD_BOMB); + if(right_way) + { + badguy->timer.start(0); + badguy->mode = BOMB_TICKING; + } + remove_me(); } @@ -1279,7 +1285,7 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) if (pbad_c->kind == BAD_MRBOMB) { // mrbomb transforms into a bomb now - pbad_c->explode(); + pbad_c->explode(true); return; } else if (pbad_c->kind != BAD_MRBOMB) @@ -1294,7 +1300,7 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) if (pbad_c->kind == BAD_MRBOMB) { // mrbomb transforms into a bomb now - pbad_c->explode(); + pbad_c->explode(false); return; } else diff --git a/src/badguy.h b/src/badguy.h index 7b607e113..f5cd806d9 100644 --- a/src/badguy.h +++ b/src/badguy.h @@ -163,7 +163,8 @@ private: /** let the player jump a bit (used when you hit a badguy) */ void make_player_jump(Player* player); - void explode(); + /** Turn enemy into a bomb. To explode right way pass true */ + void explode(bool right_away); /** check if we're running left or right in a wall and eventually change * direction -- 2.11.0