From 7fa7d613f6bc5afc0f08ab8cd5fd2dea52f44d4a Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Tue, 16 Jan 2007 19:49:53 +0000 Subject: [PATCH] Tried reducing extent of motion sickness induced by Camera algorithm SVN-Revision: 4584 --- src/object/camera.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/object/camera.cpp b/src/object/camera.cpp index b9d0097bb..41fc561a7 100644 --- a/src/object/camera.cpp +++ b/src/object/camera.cpp @@ -253,8 +253,19 @@ Camera::update_scroll_normal(float elapsed_time) // when suddenly changing directions while scrolling into the other direction. // abort scrolling, since tux might be going left/right at a relatively small // part of the map (like when jumping upwards) - if((player->dir == ::LEFT && scrollchange == RIGHT) - || (player->dir == ::RIGHT && scrollchange == LEFT)) + + + // Find out direction in which the player walks: We want to try and show a + // bit more of what's in front of the player and less of what's behind + LeftRightScrollChange walkDirection; + if (player->physic.get_velocity_x() < -EPSILON) walkDirection = LEFT; + else if (player->physic.get_velocity_x() > EPSILON) walkDirection = RIGHT; + else if (player->dir == ::LEFT) walkDirection = LEFT; + else walkDirection = RIGHT; + + + if((walkDirection == LEFT && scrollchange == RIGHT) + || (walkDirection == RIGHT && scrollchange == LEFT)) scrollchange = NONE; // when in left 1/3rd of screen scroll left if(player->get_bbox().get_middle().x < translation.x + SCREEN_WIDTH/3 - 16 -- 2.11.0