summaryrefslogtreecommitdiff
path: root/Level.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Level.cpp')
-rw-r--r--Level.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/Level.cpp b/Level.cpp
index e39ab30..d956a78 100644
--- a/Level.cpp
+++ b/Level.cpp
@@ -96,8 +96,12 @@ void Level::move() {
}
void Level::draw(Screen *screen) {
+ int x = cameraX
+ * (SCREEN_WIDTH - background->w)
+ / (SCREEN_WIDTH - MAP_X*50);
+ int y = SCREEN_HEIGHT - background->h;
// Blit background
- screen->blit(0, 0, background);
+ screen->blit(x, y, background);
// If player is in the middle of the screen ...
if (player.getX() + cameraX > SCREEN_WIDTH / 2 - player.getClip()->w / 2 + player.getXVel()