Skip to content

propsStore version2

LiwenJin2829 edited this page Oct 19, 2021 · 6 revisions

Where could be find the prop store?

Description: You can enter the props store through the gold coin icon in the upper right corner of the menu.

How does the prop store look on the whole?

Description: Props store is a place to buy props, and props are placed on shelves.

What sort of props could we purchase?

Description: There are 6 kinds of props in the props store, including firstAidKit, apple, magicPotion, bandage, water and syringe.

Where could we find how many goldCoin we've got?

Description: You can see the number of gold coins in the upper left corner.

The prop firstAidKit and its detail:

The prop apple and its detail:

The prop magicPotion and its detail:

The prop bandage and its detail:

The prop water and its detail:

The prop syringe and its detail:

The backgroundMusic button and its detail:

The exit button:

How they implemented?

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);
        }
    }

UML class diagram

Zoom.png PropStoreDisplay.java

PropStoreGoldDisplay.java

PropStoreItemDisplay.java

UML sequence diagram

PropStoreDisplay.java

PropStoreGoldDisplay.java

PropStoreItemDisplay.java

Gameplay

Home

Main Character

πŸ‘Ύ Obstacle/Enemy

Food & Water

Pickable Items

Game achievements

Game Design

Emotional Goals

Game Story

Influences

Style

Pixel Grid Resolution

Camera Angle and The Player's Perspective

Features Design

Achievements Screen

Achievements Trophies and Cards

Music Selection GUI

πŸ‘Ύ Obstacle/Enemy

 Monster Manual
 Obstacles/Enemies
  - Alien Plants
  - Variation thorns
  - Falling Meteorites
  - FaceHugger
  - AlienMonkey
 Spaceship & Map Entry
 Particle effect

Buffs

Debuffs

Buffs and Debuffs manual

Game Instruction

[code for debuff animations](code for debuff animations)

Infinite loop game system

Main Menu Screen

New Setting Screen

Hunger and Thirst

Goals and Objectives

HUD User Interface

Inventory System

Item Bar System

Scoring System

Props store

BGM design

Sound Effect design

Main game interface

Invisible ceiling

New terrain sprint 4

New game over screen sprint 4

Code Guidelines

Main Character Movement, Interactions and Animations - Code Guidelines

Item Pickup

ItemBar & Recycle system

Main Menu Button Code

Game Instructions Code

πŸ‘Ύ Obstacle/Enemy

 Obstacle/Enemy
 Monster Manual
 Spaceship Boss
 Particle effects
 Other Related Code
 UML & Sequence diagram of enemies/obstacles

Scoring System Implementation Explanation

Music Implementation

Buff and Debuff Implementation

Score History Display

code improvement explanation

Infinite generating terrains Implementation Explanation

Game Over Screen and functions explaination

Buffer timer before game start

Scrolling background

Multiple Maps

Invisible ceiling

Rocks and woods layout optimization

Magma and nails code implementation

Background Music Selection

Chooser GUI Implementation

Chooser GUI Logic Persistence

Guide: Adding Background music for a particular screen

Achievements Ecosystem - Code Guidelines

Achievements System

Achievements Screen

Adding Achievements (Guide)

Game Records

DateTimeUtils

History Scoreboard - Score Details

Listening for important events in the Achievements ecosystem

Food and Water System

Food System Water System

Hunger and Thirst icon code guidelines

Asset Creation

In Game Background Music

User Testing

Hunger and Thirst User Testing

Main Character Testing

Buffs and Debuffs Testing

Buff and Debuff Manual User Testing

Game Instruction User Testing

The Main Menu User Test

The New Button User Test in Setting Page

The Main Menu Buttons User Testing

Hunger and Thirst User Test

Infinite loop game and Terrain Testing

Item Bar System Testing

Randomised Item Drops

Recycle System Testing

Scoring System Testing

Music User test

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

Inventory system UI layout

Props store user testing

Achievements User Testing

Sprint 1

Sprint 2

Sprint 3

Sprint 4

Items testing

Player Status testing

Changeable background & Buffer time testing

Main game interface test

Invisible ceiling test

Game over screen test sprint 4

New terrain textures on bonus map test sprint 4

Buying Props User Testing

Testing

Hunger and Thirst Testing

Main Character Player

Achievements System, Game Records and Unlockable Chapters

DateTimeUtils Testing

Scoring System Testing Plan

Distance Display Testing Plan

Musics Implementation Testing plan

History Board Testing plan

Rocks and woods testing plan

Sprint 4 terrain tests

Items

Item Bar System Testing Plan

Recycle System Testing Plan

Game Engine

Game Engine Help

Getting Started

Entities and Components

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally