Changed Yeti behaviour. You must stun him (jump on him) when is under a falling stala...
[supertux.git] / src / badguy / mrbomb.cpp
index 76222d2..88db3d2 100644 (file)
@@ -29,8 +29,8 @@ MrBomb::write(lisp::Writer& writer)
 {
   writer.start_list("mrbomb");
 
-  writer.write_float("x", get_pos().x);
-  writer.write_float("y", get_pos().y);
+  writer.write_float("x", start_position.x);
+  writer.write_float("y", start_position.y);
 
   writer.end_list("mrbomb");
 }
@@ -48,7 +48,7 @@ MrBomb::collision_squished(Player& player)
 {
   remove_me();
   Sector::current()->add_object(new Bomb(get_pos(), dir));
-  player.bounce(*this);
+  kill_squished(player);
   return true;
 }
 
@@ -66,3 +66,25 @@ MrBomb::collision_solid(GameObject& , const CollisionHit& hit)
   return CONTINUE;
 }
 
+HitResponse
+MrBomb::collision_badguy(BadGuy& , const CollisionHit& hit)
+{
+  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());
+  }
+
+  return CONTINUE;
+}
+
+void
+MrBomb::kill_fall()
+{
+  remove_me();
+  Bomb* bomb = new Bomb(get_pos(), dir);
+  Sector::current()->add_object(bomb);
+  bomb->explode();
+}
+
+IMPLEMENT_FACTORY(MrBomb, "mrbomb")