summaryrefslogtreecommitdiff
path: root/Level.cpp
diff options
context:
space:
mode:
authorLuke Bratch <l_bratch@yahoo.co.uk>2010-11-27 23:21:41 +0000
committerLuke Bratch <l_bratch@yahoo.co.uk>2010-11-27 23:21:41 +0000
commita00e29799a9fa4e8f140ef3f292f3200736fe957 (patch)
tree1291f705df69dd0bab04ea03f033a59634701d51 /Level.cpp
parenta8b7a90a5886054de083b8c82300fbbfc198fa5a (diff)
Level: Scroll when near, rather than at, the right edge of the screen
Diffstat (limited to 'Level.cpp')
-rw-r--r--Level.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/Level.cpp b/Level.cpp
index 2c358da..dc36e24 100644
--- a/Level.cpp
+++ b/Level.cpp
@@ -60,7 +60,7 @@ void Level::move() {
}
}
- if (rect.x >= 0 && rect.x <= SCREEN_WIDTH - rect.w) {
+ if (rect.x >= 0 && rect.x <= SCREEN_WIDTH - rect.w - 32) {
player.setX(rect.x);
}
@@ -92,7 +92,8 @@ void Level::draw(Screen *screen) {
screen->blit(player.getX(), player.getY(), player.image, player.getClip());
// Scroll level
- if (player.getX() == 0 || player.getX() >= SCREEN_WIDTH - player.getClip()->w - MOVE_AMOUNT) {
+ if (player.getX() == 0 || player.getX() >= SCREEN_WIDTH
+ - player.getClip()->w - 32 - MOVE_AMOUNT) {
if (player.getXVel() < 0 || player.getXVel() > 0)
cameraX -= player.getXVel();
}