Added a negative y-velocity component to horizontal climbing alignment adjustment...
authorLMH <lmh.0013@gmail.com>
Wed, 4 Sep 2013 00:47:41 +0000 (14:47 -1000)
committerLMH <lmh.0013@gmail.com>
Wed, 4 Sep 2013 00:47:41 +0000 (14:47 -1000)
src/trigger/climbable.cpp

index 35ccc06..1d7eb66 100644 (file)
@@ -91,8 +91,9 @@ Climbable::event(Player& player, EventType type)
         activate_try_timer.stop();
       } else {
         if (type == EVENT_ACTIVATE) activate_try_timer.start(ACTIVATE_TRY_FOR);
-        if (player.get_bbox().p1.x < get_bbox().p1.x - GRACE_DX) player.add_velocity(Vector(POSITION_FIX_AX,0));
-        if (player.get_bbox().p2.x > get_bbox().p2.x + GRACE_DX) player.add_velocity(Vector(-POSITION_FIX_AX,0));
+        // the "-13" to y velocity prevents Tux from walking in place on the ground for horizonal adjustments
+        if (player.get_bbox().p1.x < get_bbox().p1.x - GRACE_DX) player.add_velocity(Vector(POSITION_FIX_AX,-13));
+        if (player.get_bbox().p2.x > get_bbox().p2.x + GRACE_DX) player.add_velocity(Vector(-POSITION_FIX_AX,-13));
         if (player.get_bbox().p1.y < get_bbox().p1.y - GRACE_DY) player.add_velocity(Vector(0,POSITION_FIX_AY));
         if (player.get_bbox().p2.y > get_bbox().p2.y + GRACE_DY) player.add_velocity(Vector(0,-POSITION_FIX_AY));
       }