-
Notifications
You must be signed in to change notification settings - Fork 4
Water System
The amount of water and food icons under the health bar will decrease over time. The player needs to restore his state by picking up water and food which is resources that may appear on the map, otherwise he will be affected by the two negative buffs :thirst and hunger.
- thirsty
WaterDisplay.java
The icon of the water will be stored in a list-waterImage , The timing refers to the scoreing system developed by the group 9
public static ArrayList<Image> chickenImage = new ArrayList<>();
The listeners implemented here lookout for trigger eventsοΌCreates reusable drop of water ui styles and adds actors to the stage.
public void create() {
super.create();
addActors();
entity.getEvents().addListener("updateWater", this::updatePlayerTimerUI);
}
Creates actors, add images into list, and positions them on the stage using a table.
private void addActors() {
table = new Table();
table.top().left();
table.setFillParent(true);
table.padTop(150f).padLeft(10f);
//Add water image
float clockSideLength = 30f;
waterImage.add(new Image(ServiceLocator.getResourceService()
.getAsset("images/water1.png", Texture.class)));
waterImage.add(new Image(ServiceLocator.getResourceService()
.getAsset("images/water1.png", Texture.class)));
waterImage.add(new Image(ServiceLocator.getResourceService()
.getAsset("images/water1.png", Texture.class)));
waterImage.add(new Image(ServiceLocator.getResourceService()
.getAsset("images/water1.png", Texture.class)));
add images into the screen
table.add(waterImage.get(0)).size(clockSideLength).pad(3);
table.add(waterImage.get(1)).size(clockSideLength).pad(3);
table.add(waterImage.get(2)).size(clockSideLength).pad(3);
table.add(waterImage.get(3)).size(clockSideLength).pad(3);
stage.addActor(table);
Reduce water when time increase, and lookout for trigger event
public void update() {
super.update();
int minutes = countTime.getMinutes();
int seconds = countTime.getSeconds();
int dis = (minutes*60+seconds)/2;
if(dis> countWaterSystem.getTimer()){
countWaterSystem.setDifference(1);
countWaterSystem.setTimer(dis);
}else {
countWaterSystem.setDifference(0);
}
//update the water regularly
entity.getEvents().trigger("updateWater", countWaterSystem.getDifference());
}
}
Updates the Chicken ui time by time increase.
if(waterImage.size() > 0){
table.reset();
table.top().left();
table.setFillParent(true);
table.padTop(150f).padLeft(10f);
waterImage.remove(waterImage.size() - 1);
for (Image ima: waterImage) {
table.add(ima).size(30f).pad(3);
}
}
}
}
remove chickenImage by useing a for loop
public void dispose() {
super.dispose();
timeLabel.remove();
for (int i = 0; i < waterImage.size(); ++i){
waterImage.remove(i);
}
}
Add/remove a image, value =1: add a waterimage; value = -1 :remove a water image
public static void addOrRemoveImage(int value){
if(value == 1){
if(chickenImage.size() < 4){
chickenImage.add(new Image(ServiceLocator.getResourceService()
.getAsset("images/water1.png", Texture.class)));
table.add(chickenImage.get(images/water1.size() - 1)).size(30f).pad(3);
}
}else if(value == -1){
if(chickenImage.size() > 0){
table.removeActor(chickenImage.get(chickenImage.size() - 1));
}
}
}
if there is no images in the list, it will return a true
public static boolean isThirst(){
return waterImage.size() <= 0;;
}
add a water icon on main screen when player pick up a target(item)
public void increaseWater(Entity target) {
if (target != null) {
if (WaterDisplay.waterImage.size() < 4) {
WaterDisplay.addOrRemoveImage(1);
}
if water icon count less than 0, then it will be into that codes to run. it reduce player health value.
public void updatePlayerHealth(int dis){
if(dis == 2){
if(waterImage.size() <= 0){
//if water icon count less than 0, then it will be into that codes to run. it reduce player health value.
//reduce player health value
MainGameScreen.players.getComponent(CombatStatsComponent.class).setHealth(
MainGameScreen.players.getComponent(CombatStatsComponent.class).getHealth() - 1
);
}
}
}
Camera Angle and The Player's Perspective
Achievements Trophies and Cards
πΎ Obstacle/Enemy
βMonster Manual
βObstacles/Enemies
ββ- Alien Plants
ββ- Variation thorns
ββ- Falling Meteorites
ββ- FaceHugger
ββ- AlienMonkey
βSpaceship & Map Entry
βParticle effect
[code for debuff animations](code for debuff animations)
Main Character Movement, Interactions and Animations - Code Guidelines
ItemBar & Recycle system
πΎ Obstacle/Enemy
βObstacle/Enemy
βMonster Manual
βSpaceship Boss
βParticle effects
βOther Related Code
βUML & Sequence diagram of enemies/obstacles
Scoring System Implementation Explanation
Buff and Debuff Implementation
Infinite generating terrains Implementation Explanation
Game Over Screen and functions explaination
Buffer timer before game start
Rocks and woods layout optimization
Magma and nails code implementation
Guide: Adding Background music for a particular screen
History Scoreboard - Score Details
Listening for important events in the Achievements ecosystem
Hunger and Thirst icon code guidelines
Hunger and Thirst User Testing
Buff and Debuff Manual User Testing
The New Button User Test in Setting Page
The Main Menu Buttons User Testing
Infinite loop game and Terrain Testing
https://github.com/UQdeco2800/2021-ext-studio-2.wiki.git
πΎ Obstacle/Enemy
βObstacle testing
ββ- Alien Plants & Variation Thorns
ββ- Falling Meteorites
βEnemy testing
ββ- Alien Monkeys & Facehugger
ββ- Spaceship Boss
βMonster Manual
βParticle-effect
βPlayer attack testing
ββ- Player Attack
Sprint 1
Sprint 2
Sprint 3
Sprint 4
Changeable background & Buffer time testing
Game over screen test sprint 4
New terrain textures on bonus map test sprint 4
Achievements System, Game Records and Unlockable Chapters
Musics Implementation Testing plan