-
Notifications
You must be signed in to change notification settings - Fork 4
propsStore version2
Description: You can enter the props store through the gold coin icon in the upper right corner of the menu.
Description: Props store is a place to buy props, and props are placed on shelves.
Description: There are 6 kinds of props in the props store, including firstAidKit, apple, magicPotion, bandage, water and syringe.
Description: You can see the number of gold coins in the upper left corner.
They were implemented from PropStoreDisplay.java PropStoreGoldDisplay.java PropStoreItemDisplay.java and PropStoreRecord.java
Under PropStoreDisplay.java:
There are two main func used to create the exit button and the item label
private Table createExitButton(){
Image exitImg = new Image(ServiceLocator.getResourceService().getAsset("images/achievements/crossButton.png", Texture.class));
ImageButton exitImageButton = new ImageButton(exitImg.getDrawable());
exitImageButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
game.setScreen(GdxGame.ScreenType.MAIN_MENU);
}
});
Table table = new Table();
table.setFillParent(true);
table.top().right();
table.add(exitImageButton);
return table;
}
private Table createItemTable(){
Table table = new Table();
table.setFillParent(true);
table.center();
PropStoreFactory.getPropStoreItems().forEach(item -> {
Label price = new Label("Gold $: " + item.price, new Label.LabelStyle(new BitmapFont(), Color.YELLOW));
price.setFontScale(2f);
TextButton button = new TextButton("View",skin);
button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
entity.getEvents().trigger("openItem", item);
}
});
button.setColor(Color.RED);
Image img = new Image(ServiceLocator.getResourceService().getAsset(item.path, Texture.class));
Table itemTable = new Table();
itemTable.add(img);
itemTable.row();
itemTable.add(price);
itemTable.padLeft(20f).padRight(20f);
itemTable.row();
itemTable.add(button);
table.add(itemTable);
});
return table;
}
Under PropStoreGoldDisplay.java:
There is a func used to display the goldCoin amount:
private void displayGold(){
Table table = new Table();
table.setFillParent(true);
table.top().left();
Label price = new Label("Total Gold $: " + PropStoreRecord.getGold(), new Label.LabelStyle(new BitmapFont(), Color.YELLOW));
price.setFontScale(1.5f);
price.setWrap(true);
table.add(price);
stage.addActor(table);
}
Under PropStoreItemDisplay.java:
There are three func used to display the props details, render the exit button and bought button:
private void openItem(PropItemConfig item){
dialog = new Dialog("", skin);
dialog.setModal(true);
dialog.setMovable(false);
dialog.setResizable(true);
Image img = new Image(new Texture(item.path));
// Image background = new Image(new Texture("images/story/chapterDialog.png"));
//background.setScaling(Scaling.fit);
//dialog.setBackground(background.getDrawable());
dialog.pad(50).padTop(120);
Label desc = new Label(item.desc, new Label.LabelStyle(new BitmapFont(), Color.DARK_GRAY));
desc.setFontScale(1.1f);
desc.setWrap(true);
desc.setAlignment(Align.center);
Label price = new Label("Gold $: " + item.price, new Label.LabelStyle(new BitmapFont(), Color.YELLOW));
dialog.row();
price.setFontScale(1.5f);
price.setWrap(true);
price.setAlignment(Align.center);
// buyButton.setDisabled(true);
dialog.getContentTable().add(img).height(122).width(240).row();
dialog.getContentTable().add(desc).width(600).row();
dialog.getContentTable().add(price).width(600).row();
dialog.getButtonTable().add(renderButton(item)).size(600,100).row();
dialog.getButtonTable().add(renderCloseButton()).size(50, 50).row();
dialog.show(stage);
}
private ImageButton renderCloseButton() {
Image crossButtonImg = new Image(new Texture("images/achievements/crossButton.png"));
ImageButton closeButton = new ImageButton(crossButtonImg.getDrawable());
closeButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
dialog.hide();
}
});
return closeButton;
}
private TextButton renderButton(PropItemConfig item){
if(PropStoreRecord.isItemBought(item)){
TextButton buyButton = new TextButton("Bought!", skin);
buyButton.setColor(Color.LIME);
buyButton.setDisabled(true);
return buyButton;
}
if(PropStoreRecord.hasEnoughGold(item.price)) {
TextButton buyButton = new TextButton("Buy for " + item.price + " gold", skin);
buyButton.setColor(Color.ROYAL);
buyButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
PropStoreRecord.buyItem(item);
entity.getEvents().trigger("GoldUpdate");
buyButton.setText("Bought!");
buyButton.setColor(Color.LIME);
buyButton.setDisabled(true);
}
});
return buyButton;
}else{
TextButton buyButton = new TextButton("You do not have enough Gold", skin);
buyButton.setColor(Color.BLACK);
buyButton.setDisabled(true);
return buyButton;
}
}
And under the PropStoreRecord.java
There are few funcs used to record the goldCoin amount:
public static int getGold() {
Gold goldRecord = FileLoader.readClass(Gold.class, goldPath, location);
return goldRecord != null ? goldRecord.gold : new Gold().gold;
}
public static void setGold(int gold) {
Gold goldRecord = new Gold();
goldRecord.gold = gold;
FileLoader.writeClass(goldRecord, goldPath, location);
}
public static void subtractGold(int amount){
int gold = getGold();
if(gold >= amount) {
gold = gold - amount;
setGold(gold);
}
}
PropStoreDisplay.java
PropStoreGoldDisplay.java
PropStoreItemDisplay.java
PropStoreDisplay.java
PropStoreGoldDisplay.java
PropStoreItemDisplay.java
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