Experimental commit:
authorChristoph Sommer <mail@christoph-sommer.de>
Mon, 24 Jul 2006 19:26:05 +0000 (19:26 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Mon, 24 Jul 2006 19:26:05 +0000 (19:26 +0000)
Water affects Tux' y-velocity /
Tux can accelerate upwards in water

SVN-Revision: 4081

src/object/player.cpp

index 7664a3b..2d7e88c 100644 (file)
@@ -516,7 +516,6 @@ Player::do_jump(float yspeed) {
 void
 Player::handle_vertical_input()
 {
-
   // Press jump key
   if(controller->pressed(Controller::JUMP) && (can_jump)) {
     if (duck) {
@@ -544,6 +543,13 @@ Player::handle_vertical_input()
   /* When Down is not held anymore, disable butt jump */
   if(butt_jump && !controller->hold(Controller::DOWN))
     butt_jump = false;
+  // swimming 
+  physic.set_acceleration_y(0);
+  if (swimming) {
+    if (controller->hold(Controller::UP) || controller->hold(Controller::JUMP)) physic.set_acceleration_y(-2000);
+    physic.set_velocity_y(physic.get_velocity_y() * 0.94);
+  }
 }
 
 void