From: Ryan Flegel Date: Fri, 28 Apr 2006 03:26:19 +0000 (+0000) Subject: Let Tux bounce off badguys when he's invincible. This let's us bounce off guys like... X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=f53572ad2b744ddddd7cc4b6479489543d44f98d;p=supertux.git Let Tux bounce off badguys when he's invincible. This let's us bounce off guys like the flying snowball without falling to our deaths. Tux no longer kicks mriceblocks right before picking them up. SVN-Revision: 3456 --- diff --git a/src/badguy/badguy.cpp b/src/badguy/badguy.cpp index 51a03f895..fb2fff941 100644 --- a/src/badguy/badguy.cpp +++ b/src/badguy/badguy.cpp @@ -167,11 +167,6 @@ BadGuy::collision_solid(GameObject& , const CollisionHit& ) HitResponse BadGuy::collision_player(Player& player, const CollisionHit& ) { - if(player.is_invincible()) { - kill_fall(); - return ABORT_MOVE; - } - /* printf("PlayerHit: GT %3.1f PM: %3.1f %3.1f BM: %3.1f %3.1f Hit: %3.1f %3.1f\n", game_time, @@ -187,6 +182,11 @@ BadGuy::collision_player(Player& player, const CollisionHit& ) return ABORT_MOVE; } + if(player.is_invincible()) { + kill_fall(); + return ABORT_MOVE; + } + player.kill(false); return FORCE_MOVE; } diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 3361f41ab..1ec23a9f5 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -22,9 +22,11 @@ #include "mriceblock.hpp" #include "object/block.hpp" -static const float WALKSPEED = 80; -static const float KICKSPEED = 500; -static const int MAXSQUISHES = 10; +namespace { + const float WALKSPEED = 80; + const float KICKSPEED = 500; + const int MAXSQUISHES = 10; +} MrIceBlock::MrIceBlock(const lisp::Lisp& reader) : ice_state(ICESTATE_NORMAL), squishcount(0) @@ -146,13 +148,18 @@ MrIceBlock::collision_player(Player& player, const CollisionHit& hit) // handle kicks from left or right side if(ice_state == ICESTATE_FLAT && get_state() == STATE_ACTIVE) { + // Don't kick if the player is going to pick us up + if (player.get_controller()->hold(Controller::ACTION)) + return FORCE_MOVE; + // hit from left side if(hit.normal.x > 0.7) { dir = RIGHT; player.kick(); set_state(ICESTATE_KICKED); return FORCE_MOVE; - } else if(hit.normal.x < -0.7) { + } + else if(hit.normal.x < -0.7) { dir = LEFT; player.kick(); set_state(ICESTATE_KICKED);