Mr Bomb turns arround again when colliding with other badguys.
authorWolfgang Becker <uafr@gmx.de>
Sun, 9 Jul 2006 12:05:26 +0000 (12:05 +0000)
committerWolfgang Becker <uafr@gmx.de>
Sun, 9 Jul 2006 12:05:26 +0000 (12:05 +0000)
SVN-Revision: 3967

src/badguy/mrbomb.cpp
src/badguy/mrbomb.hpp

index 15ab8f5..d59b958 100644 (file)
@@ -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;
 }
 
index 5aa053a..450d0d1 100644 (file)
@@ -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); }