-
Notifications
You must be signed in to change notification settings - Fork 4
Interfaces
The buildings are designed as obstacles positioned so that there is a moment of response time left for the player to control the game along with having the health of the in-game player on check
Building : 1
Building: 2
Walls are also a defensive obstacle that favours the user with accordance to the response time in game
Wall: 1
Functions and methods used to deploy these into the source code :
- createWallTower()
- createWeaponTower()
- spawnBaseTower(); spawnWeaponTower(); //spawnWallTower();
- createBaseTower()
The final picture after colour-coordinating the options and background:
- The color used in the background is : #0x809930FF.
** Drag and drop **
class used to implement this feature : GameAreaDisplay Functions used to implement this : Mouse input functions
Game over popup class used to implement this feature : PlayerStatsDisplay Function used to implement this : showGameOverPopup()
*private void showGameOverPopup() { // Create a Dialog pop-up for game over. Dialog gameOverDialog = new Dialog("Game Over", skin);
// Add a label with the game over message.
gameOverDialog.text("Your health reached 0. The game is over.");
// Add a button to restart the game or exit.
TextButton restartButton = new TextButton("Restart", skin);
TextButton exitButton = new TextButton("Exit", skin);
restartButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
// Reset the player's health to 100.
CombatStatsComponent combatStats = entity.getComponent(CombatStatsComponent.class);
combatStats.setHealth(100);
// Update the UI to reflect the new health value.
updatePlayerHealthUI(combatStats.getHealth());
}
});
exitButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
// Handle exiting the game (e.g., return to the main menu or close the app).
// You can use Gdx.app.exit() to close the app gracefully.
Gdx.app.exit();
}
});
**Skin selected :