incorporated another patch from Ondra Hosek which fixes tux not getting killed on...
[supertux.git] / src / badguy / snowball.cpp
index 4442d02..4efd938 100644 (file)
@@ -64,3 +64,15 @@ SnowBall::collision_solid(GameObject& , const CollisionHit& hit)
   return CONTINUE;
 }
 
+HitResponse
+SnowBall::collision_badguy(BadGuy& , const CollisionHit& hit)
+{
+  if(fabsf(hit.normal.x) > .8) { // left or right hit
+    dir = dir == LEFT ? RIGHT : LEFT;
+    sprite->set_action(dir == LEFT ? "left" : "right");
+    physic.set_velocity_x(-physic.get_velocity_x());       
+  }
+
+  return CONTINUE;
+}
+