summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Level.cpp11
-rw-r--r--level01.map2
2 files changed, 5 insertions, 8 deletions
diff --git a/Level.cpp b/Level.cpp
index c4da3b2..a787e94 100644
--- a/Level.cpp
+++ b/Level.cpp
@@ -20,13 +20,6 @@ void Level::changeLevel(int levelNo) {
Hazard hazard1;
Platform platform1;
- // Placing the player for fun/demonstration purposes
- player.setX(0);
- player.setY(0);
-
- // Checking where the player is for fun/demonstration purposes
- std::cout << "Level::changeLevel(): player is at " << player.getX() << ", " << player.getY() << ".\n";
-
// Load background image
if (!(background = loadImage("space.png")))
std::cout << "Level::changeLevel: Error loading background image.\n";
@@ -151,6 +144,10 @@ void Level::loadMap(int LevelNo) {
platform[numPlatforms].setClip(0, TILE_SIZE * (type - 1), 0, TILE_SIZE, TILE_SIZE);
numPlatforms++;
+ } else if (type == 'P') {
+ // Set the player starting position
+ player.setX((i % MAP_X) * TILE_SIZE);
+ player.setY((i / MAP_X) * TILE_SIZE - player.getClip()->h);
}
}
diff --git a/level01.map b/level01.map
index 0a06e97..7d7e88d 100644
--- a/level01.map
+++ b/level01.map
@@ -5,7 +5,7 @@
00 00 00 00 00 00 00 00 00 00 00 01 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 03 00
00 00 00 00 00 00 00 00 00 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 00 00 00 00
00 00 00 00 00 00 00 02 02 02 00 02 00 00 00 00 00 00 00 00 00 00 00 02 02 02 00 02 00 00 00 00 00 00 00 00 00 00 00 02 02 02 00 00 00 00 00 00
-00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
+00 80 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
01 01 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
02 02 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
05 00 00 00 00 05 05 05 05 05 05 05 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00