diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-12-03 12:38:03 +0000 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-12-03 12:38:03 +0000 |
commit | ff9f965f9290d5e9985c695556c3164a6a751e75 (patch) | |
tree | c1435065acb8707f2b0ede49fc383b6b74ff5fdb | |
parent | bc01a352740c34e5f2f83efbee14e0bc9ef28ba5 (diff) |
Code cleanups
-rw-r--r-- | Level.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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++) { |