A rouge-like rpg, heavily inspired on the binding of isaac. Running on a FRDM-K64F Mbed board. C++.
Dependencies: mbed MotionSensor
Diff: RoomEngine/RoomEngine.cpp
- Revision:
- 44:cc4cecfc639f
- Parent:
- 43:63f5c9d9689c
- Child:
- 45:8725b4171646
diff -r 63f5c9d9689c -r cc4cecfc639f RoomEngine/RoomEngine.cpp --- a/RoomEngine/RoomEngine.cpp Tue May 07 20:57:44 2019 +0000 +++ b/RoomEngine/RoomEngine.cpp Tue May 07 23:53:29 2019 +0000 @@ -295,24 +295,24 @@ void RoomEngine::check_walls_collision() { -// // Enemy -// for (int i = 0; i < MAX_ENEMIES; i++) { -// if(room->valid_enemies[i]) { -// room->enemies[i]->undo_move_x(entity_move_check_x(room->enemies[i], room->walls, 2, 10, room->valid_walls)); -// room->enemies[i]->undo_move_y(entity_move_check_y(room->enemies[i], room->walls, 2, 10, room->valid_walls)); -// } -// } -// // Player -// player->undo_move_x(entity_move_check_x(player, room->walls, 2, 10, room->valid_walls)); -// player->undo_move_y(entity_move_check_y(player, room->walls, 2, 10, room->valid_walls)); -// // Bullets -// for (int i = 0; i < bullets_max; i++) { -// for (int j = 0; j < 2; j++) { -// if ((player->valid_bullets[i]) && (room->valid_walls[j]) && (entity_collision(*player->bullets_array[i], *room->walls[j]))) { -// delete player->bullets_array[i]; player->valid_bullets[i] = false; -// } -// } -// } + // Enemy + for (int i = 0; i < MAX_ENEMIES; i++) { + if(room->valid_enemies[i]) { + room->enemies[i]->undo_move_x(entity_move_check_x(room->enemies[i], room->walls, 2, 10, room->valid_walls)); + room->enemies[i]->undo_move_y(entity_move_check_y(room->enemies[i], room->walls, 2, 10, room->valid_walls)); + } + } + // Player + player->undo_move_x(entity_move_check_x(player, room->walls, 2, 10, room->valid_walls)); + player->undo_move_y(entity_move_check_y(player, room->walls, 2, 10, room->valid_walls)); + // Bullets + for (int i = 0; i < bullets_max; i++) { + for (int j = 0; j < 2; j++) { + if ((player->valid_bullets[i]) && (room->valid_walls[j]) && (entity_collision(*player->bullets_array[i], *room->walls[j]))) { + delete player->bullets_array[i]; player->valid_bullets[i] = false; + } + } + } } void RoomEngine::move()