summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Level.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/Level.cpp b/Level.cpp
index 6f453e3..11cb3d4 100644
--- a/Level.cpp
+++ b/Level.cpp
@@ -35,6 +35,7 @@ void Level::changeLevel(int levelNo) {
// Read the map file (all level/player init should be done here, not above)
loadMap(levelNo);
+ // Cope for no defined start position
if (startX < 0) {
startX = 0;
startY = 0;
@@ -70,9 +71,8 @@ void Level::move() {
}
}
- if (rect.x >= 0 && rect.x <= SCREEN_WIDTH - rect.w - 32) {
+ if (rect.x >= 0 && rect.x <= SCREEN_WIDTH - rect.w - 32)
player.setX(rect.x);
- }
// Player y-axis movement
rect.y = player.getY() + player.getYVel();
@@ -111,14 +111,13 @@ void Level::draw(Screen *screen) {
// Scroll level
if (player.getX() < -player.getXVel() || player.getX() >= SCREEN_WIDTH
- - player.getClip()->w - 32 - MOVE_AMOUNT) {
+ - player.getClip()->w - 32 - MOVE_AMOUNT)
if (player.getXVel() < 0 || player.getXVel() > 0)
cameraX -= player.getXVel();
- }
// Don't let the camera move to before the start of the level
if (cameraX > 0)
- cameraX = 0;
+ cameraX = 0;
// Draw each platform...
for (int i = 0; i < numPlatforms; i++) {