From eda20530dd6a1640dd09cb8c81dd76f696880914 Mon Sep 17 00:00:00 2001 From: Ricardo Cruz Date: Sat, 15 May 2004 12:08:57 +0000 Subject: [PATCH] Only do vertical scrolling when the height is higher than 19. This fixes the problem that scrolling was used in 19 Y tiles levels. Since the right number of Y tiles is 18.75, not 19. SVN-Revision: 1193 --- src/world.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/world.cpp b/src/world.cpp index 323f628f1..d795028f8 100644 --- a/src/world.cpp +++ b/src/world.cpp @@ -321,10 +321,13 @@ void World::scrolling(double frame_ratio) float tux_pos_y = tux.base.y + (tux.base.height/2); - if (scroll_y < tux_pos_y - (screen->h - Y_SPACE)) - scroll_y = tux_pos_y - (screen->h - Y_SPACE); - else if (scroll_y > tux_pos_y - Y_SPACE) - scroll_y = tux_pos_y - Y_SPACE; + if(level->height > VISIBLE_TILES_Y-1) + { + if (scroll_y < tux_pos_y - (screen->h - Y_SPACE)) + scroll_y = tux_pos_y - (screen->h - Y_SPACE); + else if (scroll_y > tux_pos_y - Y_SPACE) + scroll_y = tux_pos_y - Y_SPACE; + } // this code prevent the screen to scroll before the start or after the level's end if(scroll_y > level->height * 32 - screen->h) -- 2.11.0