X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy.cpp;h=ac0e59b0eac3557597b0a38be8405186ee8a6091;hb=03bc45b5d64e7295cb64a30116c9dbf90c0a0c7a;hp=1303cb08b706996101e85b26d7858a0b30f3b2ed;hpb=ecd2b11768920d0383309d5d4e25f1e8750fe7f3;p=supertux.git diff --git a/src/badguy.cpp b/src/badguy.cpp index 1303cb08b..ac0e59b0e 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -34,6 +34,7 @@ #include "level.h" #include "sector.h" #include "tilemap.h" +#include "statistics.h" Sprite* img_mriceblock_flat_left; Sprite* img_mriceblock_flat_right; @@ -365,9 +366,9 @@ BadGuy::action_mriceblock(double elapsed_time) if(tux.input.fire != DOWN) /* SHOOT! */ { if(dir == LEFT) - base.x -= 24; + base.x = tux.base.x - base.width; else - base.x += 24; + base.x = tux.base.x + tux.base.width; old_base = base; mode=KICK; @@ -404,20 +405,27 @@ void BadGuy::check_horizontal_bump(bool checkcliff) { float halfheight = base.height / 2; - if (dir == LEFT && issolid( base.x, (int) base.y + halfheight)) + if (dir == LEFT && issolid( base.x, base.y + halfheight)) { if (kind == BAD_MRICEBLOCK && mode == KICK) + { Sector::current()->trybreakbrick(Vector(base.x, base.y + halfheight), false); + Sector::current()->tryemptybox(Vector(base.x, base.y + halfheight), dir); + } dir = RIGHT; physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y()); return; } - if (dir == RIGHT && issolid( base.x + base.width, (int)base.y + halfheight)) + if (dir == RIGHT && issolid( base.x + base.width, base.y + halfheight)) { if (kind == BAD_MRICEBLOCK && mode == KICK) + { Sector::current()->trybreakbrick( - Vector(base.x + base.width, (int) base.y + halfheight), false); + Vector(base.x + base.width, base.y + halfheight), false); + Sector::current()->tryemptybox( + Vector(base.x + base.width, base.y + halfheight), dir); + } dir = LEFT; physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y()); @@ -1063,6 +1071,8 @@ BadGuy::squish(Player* player) Sector::current()->add_score(Vector(base.x, base.y), 25 * player_status.score_multiplier); SoundManager::get()->play_sound(IDToSound(SND_SQUISH), get_pos(), Sector::current()->player->get_pos()); + + global_stats.add_points(BADGUYS_SQUISHED_STAT, 1); player_status.score_multiplier++; return; @@ -1114,6 +1124,8 @@ BadGuy::squish(Player* player) Sector::current()->add_score(Vector(base.x, base.y), 25 * player_status.score_multiplier); + + global_stats.add_points(BADGUYS_SQUISHED_STAT, 1); player_status.score_multiplier++; // simply remove the fish... @@ -1149,7 +1161,8 @@ BadGuy::squish(Player* player) player->bounce(this); base.y += 66 - base.height; - + + global_stats.add_points(BADGUYS_SQUISHED_STAT, 1); Sector::current()->add_score(Vector(base.x, base.y), 25 * player_status.score_multiplier); player_status.score_multiplier++;