diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/alien.cpp | 2 | ||||
-rw-r--r-- | src/enemy_bullet.cpp | 2 | ||||
-rw-r--r-- | src/game_entity.cpp | 5 | ||||
-rw-r--r-- | src/game_state.cpp | 8 | ||||
-rw-r--r-- | src/player_missile.cpp | 2 | ||||
-rw-r--r-- | src/shield.cpp | 2 | ||||
-rw-r--r-- | src/spacebot.cpp | 1 | ||||
-rw-r--r-- | src/spaceship.cpp | 2 |
8 files changed, 19 insertions, 5 deletions
diff --git a/src/alien.cpp b/src/alien.cpp index 2b222fd..3fa9b28 100644 --- a/src/alien.cpp +++ b/src/alien.cpp @@ -1,7 +1,7 @@ #include "alien.h" Alien::Alien(int x, int y) - :x(x), y(y) + :GameEntity(x, y) { } diff --git a/src/enemy_bullet.cpp b/src/enemy_bullet.cpp index 75e3e8b..6ae5066 100644 --- a/src/enemy_bullet.cpp +++ b/src/enemy_bullet.cpp @@ -1,6 +1,6 @@ #include "enemy_bullet.h" EnemyBullet::EnemyBullet(int x, int y) - :x(x), y(y) + :GameEntity(x, y) { } diff --git a/src/game_entity.cpp b/src/game_entity.cpp new file mode 100644 index 0000000..1b4e7e3 --- /dev/null +++ b/src/game_entity.cpp @@ -0,0 +1,5 @@ +#include "game_entity.h" + +GameEntity::GameEntity(int x, int y) + :_x(x), _y(y) +{} diff --git a/src/game_state.cpp b/src/game_state.cpp index 340bcd3..2a9975e 100644 --- a/src/game_state.cpp +++ b/src/game_state.cpp @@ -50,3 +50,11 @@ GameState::GameState(std::string mapFilename) } } } + +void GameState::logState() +{ + for (auto alien : aliens) + { + std::cout << "Alien (" << alien.x() << ", " << alien.y() << ")" << std::endl; + } +} diff --git a/src/player_missile.cpp b/src/player_missile.cpp index b0dbdc2..a95e928 100644 --- a/src/player_missile.cpp +++ b/src/player_missile.cpp @@ -1,6 +1,6 @@ #include "player_missile.h" PlayerMissile::PlayerMissile(int x, int y) - :x(x), y(y) + :GameEntity(x, y) { } diff --git a/src/shield.cpp b/src/shield.cpp index b58714a..7457554 100644 --- a/src/shield.cpp +++ b/src/shield.cpp @@ -1,6 +1,6 @@ #include "shield.h" Shield::Shield(int x, int y) - :x(x), y(y) + :GameEntity(x, y) { } diff --git a/src/spacebot.cpp b/src/spacebot.cpp index f30bb34..9d2df5c 100644 --- a/src/spacebot.cpp +++ b/src/spacebot.cpp @@ -8,6 +8,7 @@ Spacebot::Spacebot(std::string outputPath) : outputFilename(outputPath+"/move.txt"), gameState(outputPath+"/map.txt") { + gameState.logState(); } void Spacebot::writeNextMove() diff --git a/src/spaceship.cpp b/src/spaceship.cpp index faf2501..b1cee9a 100644 --- a/src/spaceship.cpp +++ b/src/spaceship.cpp @@ -1,6 +1,6 @@ #include "spaceship.h" Spaceship::Spaceship(int x, int y) - :x(x), y(y) + :GameEntity(x, y) { } |