Cleaned up some junk in bonus_block.
[supertux.git] / src / object / coin.cpp
index 86e4dd8..3b0efc1 100644 (file)
@@ -208,8 +208,12 @@ HeavyCoin::collision_solid(const CollisionHit& hit)
   if(hit.bottom) {
     if(physic.get_velocity_y() > clink_threshold)
       sound_manager->play("sounds/coin.wav");
-    physic.set_velocity_y(0);
-    physic.set_velocity_x(0);
+    if(physic.get_velocity_y() > 200) {// lets some coins bounce
+      physic.set_velocity_y(-99);
+    }else{
+      physic.set_velocity_y(0);
+      physic.set_velocity_x(0);
+    }
   }
   if(hit.right || hit.left) {
     if(physic.get_velocity_x() > clink_threshold || physic.get_velocity_x() < clink_threshold)
@@ -219,7 +223,7 @@ HeavyCoin::collision_solid(const CollisionHit& hit)
   if(hit.top) {
     if(physic.get_velocity_y() < clink_threshold)
       sound_manager->play("sounds/coin.wav");
-    physic.set_velocity_y(0);
+    physic.set_velocity_y(-physic.get_velocity_y());
   }
 }