Bug 577: (Re)allow Player to low-jump from a stopped position.
authorflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 11 Feb 2010 07:51:49 +0000 (07:51 +0000)
committerflorianf <florianf@837edb03-e0f3-0310-88ca-d4d4e8b29345>
Thu, 11 Feb 2010 07:51:49 +0000 (07:51 +0000)
Reverts the player controls change from r6272 (bug 577).
Thanks to Matt McCutchen for this patch.

git-svn-id: http://supertux.lethargik.org/svn/supertux/trunk/supertux@6312 837edb03-e0f3-0310-88ca-d4d4e8b29345

src/object/player.cpp

index 393429a..3cc8a3c 100644 (file)
@@ -656,10 +656,15 @@ Player::handle_vertical_input()
   if(controller->hold(Controller::JUMP) && jump_button_timer.started() && can_jump) {
     jump_button_timer.stop();
     if (duck) {
-      // jump a little bit if moving in same direction; otherwise, do a backflip
-      if ((physic.get_velocity_x() < 0 && dir == LEFT) || (physic.get_velocity_x() > 0 && dir == RIGHT)) {
+      // when running, only jump a little bit; else do a backflip
+      if ((physic.get_velocity_x() != 0) || 
+          (controller->hold(Controller::LEFT)) || 
+          (controller->hold(Controller::RIGHT))) 
+      {
         do_jump(-300);
-      } else {
+      }
+      else 
+      {
         do_backflip();
       }
     } else {