From: Wolfgang Becker Date: Sun, 9 Jul 2006 12:05:26 +0000 (+0000) Subject: Mr Bomb turns arround again when colliding with other badguys. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a3316d68ca17966517c3f7bb0c0cb2b7e612fd0a;p=supertux.git Mr Bomb turns arround again when colliding with other badguys. SVN-Revision: 3967 --- diff --git a/src/badguy/mrbomb.cpp b/src/badguy/mrbomb.cpp index 15ab8f531..d59b9582a 100644 --- a/src/badguy/mrbomb.cpp +++ b/src/badguy/mrbomb.cpp @@ -101,16 +101,13 @@ MrBomb::collision_solid(const CollisionHit& hit) } HitResponse -MrBomb::collision_badguy(BadGuy& ) +MrBomb::collision_badguy(BadGuy&, const CollisionHit& hit ) { -#if 0 - if(fabsf(hit.normal.x) > .8) { // left or right - dir = dir == LEFT ? RIGHT : LEFT; - sprite->set_action(dir == LEFT ? "left" : "right"); - physic.set_velocity_x(-physic.get_velocity_x()); + if(hit.left || hit.right) { + dir = (dir == LEFT) ? RIGHT : LEFT; + sprite->set_action(dir == LEFT ? "left" : "right"); + physic.set_velocity_x(-physic.get_velocity_x()); } -#endif - return CONTINUE; } diff --git a/src/badguy/mrbomb.hpp b/src/badguy/mrbomb.hpp index 5aa053ade..450d0d11f 100644 --- a/src/badguy/mrbomb.hpp +++ b/src/badguy/mrbomb.hpp @@ -32,7 +32,7 @@ public: void active_update(float elapsed_time); void write(lisp::Writer& writer); void collision_solid(const CollisionHit& hit); - HitResponse collision_badguy(BadGuy& badguy); + HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); void kill_fall(); virtual MrBomb* clone() const { return new MrBomb(*this); }