diff options
author | Phil Burton <whats_up_newbie@hotmail.com> | 2010-12-17 23:34:06 +0000 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-12-17 23:34:06 +0000 |
commit | 36f5cd0d0fbbf33b47af92cb51a4b78a217a54c1 (patch) | |
tree | a555ad09902b0269936a195a2537894a400a195a | |
parent | 3dbcc5819d4762184292d6fcb05e05e73f4c721e (diff) |
Level: Implement parallax background scrolling
-rw-r--r-- | Level.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -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() |