From 20c982be17c7be640faded89ccb48a3a2de34ccc Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Mon, 24 Jul 2006 19:26:05 +0000 Subject: [PATCH] Experimental commit: Water affects Tux' y-velocity / Tux can accelerate upwards in water SVN-Revision: 4081 --- src/object/player.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/object/player.cpp b/src/object/player.cpp index 7664a3b2d..2d7e88c8c 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -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 -- 2.11.0