[ Patch #1793 ] Turn physic into POD
[supertux.git] / src / badguy / bouncing_snowball.cpp
index 9e73ee3..b28b03e 100644 (file)
@@ -26,11 +26,11 @@ static const float WALKSPEED = 80;
 
 BouncingSnowball::BouncingSnowball(const lisp::Lisp& reader)
        : BadGuy(reader, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
-{ 
+{
 }
 
 BouncingSnowball::BouncingSnowball(const Vector& pos, Direction d)
-       : BadGuy(pos, d, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
+  : BadGuy(pos, d, "images/creatures/bouncing_snowball/bouncing_snowball.sprite")
 {
 }
 
@@ -48,15 +48,15 @@ BouncingSnowball::write(lisp::Writer& writer)
 void
 BouncingSnowball::activate()
 {
-  physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
+  physic.vx = (dir == LEFT ? -WALKSPEED : WALKSPEED);
   sprite->set_action(dir == LEFT ? "left" : "right");
 }
 
 bool
-BouncingSnowball::collision_squished(Player& player)
+BouncingSnowball::collision_squished(GameObject& object)
 {
   sprite->set_action("squished");
-  kill_squished(player);
+  kill_squished(object);
   return true;
 }
 
@@ -65,18 +65,18 @@ BouncingSnowball::collision_solid(const CollisionHit& hit)
 {
   if(hit.bottom) {
     if(get_state() == STATE_ACTIVE) {
-      physic.set_velocity_y(JUMPSPEED);
+      physic.vy = JUMPSPEED;
     } else {
-      physic.set_velocity_y(0);
+      physic.vy = 0;
     }
   } else if(hit.top) {
-    physic.set_velocity_y(0);
+    physic.vy = 0;
   }
-  
+
   if(hit.left || hit.right) { // left or right collision
     dir = dir == LEFT ? RIGHT : LEFT;
     sprite->set_action(dir == LEFT ? "left" : "right");
-    physic.set_velocity_x(-physic.get_velocity_x());
+    physic.vx = -physic.vx;
   }
 }
 
@@ -88,4 +88,3 @@ BouncingSnowball::collision_badguy(BadGuy& , const CollisionHit& hit)
 }
 
 IMPLEMENT_FACTORY(BouncingSnowball, "bouncingsnowball")
-