X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy.cpp;h=7b8db66c90fb00d0b0b4cf3de033bab72bf9ef52;hb=c11b04d0525c1566260b02bacd78fd7faa7be8f1;hp=4667d58a483b095b28b3a231563566e115715be4;hpb=a3baffce3c450cc0820ee8feb110c0cf42c93643;p=supertux.git diff --git a/src/badguy.cpp b/src/badguy.cpp index 4667d58a4..7b8db66c9 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -719,6 +719,17 @@ BadGuy::action(double frame_ratio) return; } + // Kill us if we landed on spikes + if (dying == DYING_NOT + && (kind != BAD_STALACTITE && kind != BAD_FLAME && kind != BAD_BOMB) + && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y) + || isspike(base.x, base.y + base.height) + || isspike(base.x + base.width, base.y + base.height))) + { + physic.set_velocity_y(3); + kill_me(0); + } + // Once it's on screen, it's activated! if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE) seen = true; @@ -965,6 +976,7 @@ BadGuy::kill_me(int score) physic.enable_gravity(true); /* Gain some points: */ + if (score != 0) World::current()->add_score(base.x, base.y, score * player_status.score_multiplier); @@ -1018,13 +1030,14 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) case CO_BADGUY: pbad_c = (BadGuy*) p_c_object; - /* If we're a kicked mriceblock, kill any badguys we hit */ - if(kind == BAD_MRICEBLOCK && mode == KICK) + /* If we're a kicked mriceblock, kill [almost] any badguys we hit */ + if(kind == BAD_MRICEBLOCK && mode == KICK && + kind != BAD_FLAME && kind != BAD_BOMB && kind != BAD_STALACTITE) { pbad_c->kill_me(25); } - // a held mriceblock gets kills the enemy too but falls to ground then + // a held mriceblock kills the enemy too but falls to ground then else if(kind == BAD_MRICEBLOCK && mode == HELD) { pbad_c->kill_me(25); @@ -1081,8 +1094,6 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) physic.set_velocity(-fabsf(physic.get_velocity_x()), 2); } - - break; } else if (base.y + base.height > pbad_c->base.y + pbad_c->base.height) @@ -1094,6 +1105,10 @@ BadGuy::collision(void *p_c_object, int c_object, CollisionType type) { dir = RIGHT; physic.set_velocity_x(fabsf(physic.get_velocity_x())); + + // in case badguys get "jammed" + if (physic.get_velocity_x() != 0) + base.x = pbad_c->base.x + pbad_c->base.width; } else if (dir == RIGHT) {