-
Notifications
You must be signed in to change notification settings - Fork 0
Flooding System
Flooding system will shrink the city overtime while you try to build resource and optimize your procution and try to save as many people as you can. There is a flooding meter indicate when the flood will start, once the flooding meter is full, the flooing will start to cover starting from left and right of map tile and the process is repeated untill the entire map is fully covered in water and the game will be over.
Below is the code to get the tiles to be flooded. It is used under the flashTiles()
void function. The key idea is to get the left and right of the island into dictionary, and then use it for the flashing tiles.
public void flashTiles() {
// Container to represent squares to be flooded next
boolean[][] nextSquaresToBeFlooded = new boolean[mapHeight][mapWidth];
// Find the furthest left and right coordinates of the island
Pair<Integer, Integer> extremities = this.getIslandExtremities();
int farLeft = extremities.getKey();
int farRight = extremities.getValue();
// Pick tiles to be flooded and flood them
nextSquaresToBeFlooded = this.pickTilesToFlood(nextSquaresToBeFlooded, farLeft, farRight);
this.tilesToFlood = nextSquaresToBeFlooded;
this.updateFlashingTiles();
}
From here, the tilesToFlood
variable will be used again in the change the tiles into ocean Tiles in the flood()
function.
public void flood() {
for (int i = 0; i < mapHeight; i++) {
for (int j = 0; j < mapWidth; j++) {
if (tilesToFlood[i][j]) {
this.map[i][j] = this.getOceanChar();
}
}
}
disposeFloodedSquares();
}

Map
City
Buildings
Unit Selections
Game User Testing: Theme of Unit Selection & Spell System
Health Bars
In Game menu
- Feature
- User Testing:In Game Menu
Landscape Tile Design Feedback