Skip to content

Monster Manual Code

yyfyyfstudy1 edited this page Oct 5, 2021 · 8 revisions

Table of Contents

Monster Manual Screen creation

Monster Details Implementation

Secret Table Unlock

Monster manual screen creation

MonsterMenuScreen.java Is used to create the screen of the monster illustration book MonsterMenuScreen is a construction method that defines the components of the monster menu screen,it Register a UI Entity and add various components to it.

    public MonsterMenuScreen(GdxGame game) {
        logger.debug("drawing monster menu ui");
        ServiceLocator.registerInputService(new InputService());
        ServiceLocator.registerResourceService(new ResourceService());
        ServiceLocator.registerEntityService(new EntityService());
        ServiceLocator.registerRenderService(new RenderService());
        renderer = RenderFactory.createRenderer();
        renderer.getCamera().getEntity().setPosition(2f, 1f);
        loadAssets();
        Stage stage = ServiceLocator.getRenderService().getStage();
        ui = new Entity();
        monsterDispay = new MonsterDispay(game);
        ui.addComponent(monsterDispay).addComponent(new InputDecorator(stage, 10))
                .addComponent(new MonsterDetails())
                .addComponent(new BackgroundSoundComponent("sounds/mainmenu_bgm.mp3", 0.5f));
        ServiceLocator.getEntityService().register(ui);
    }

loadAssets() enables Textures to be loaded in the monster menu

    private void loadAssets() {

        ResourceService resourceService = ServiceLocator.getResourceService();
        resourceService.loadTextures(MonsterMenuTextures);
        ServiceLocator.getResourceService().loadAll();
    }

Monster details implementation

MonsterDispay.java is a component used to define the appearance of the screen, in which the style and function of the monster menu are edited. Create various tables in createMonsterMenuBoard(), these tables form the basic style of the monster menu

Create image button, and add listener to it. When it is clicked, it will trigger the effect of the pop-up page

 /**
     * Returns an image button to be reused everywhere.
     *
     * @param upPath image path
     * @param overPath image path
     * @return ImageButton in monster menu
     */
    private ImageButton getImageButton(String upPath, String overPath) {
        ImageButton.ImageButtonStyle style = new ImageButton.ImageButtonStyle();
        style.up = new TextureRegionDrawable(new TextureRegion(
                new Texture(Gdx.files.internal(upPath))));
        style.over = new TextureRegionDrawable(new TextureRegion(
                new Texture(Gdx.files.internal(overPath))));
        ImageButton button = new ImageButton(style);
        return button;
    }

    private void createMonsterMenuBoard(){

        unlockedImg.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                logger.info("Plant button clicked");
                entity.getEvents().trigger("openDetailPage");
            }
        });
     }

Create a monster display board, place a picture button, and create a monster attribute table

  //this table contains the board
        boardTable = new Table();
        boardTable.center();
        boardTable.setFillParent(true);

        monster1Table = new Table();
        Label monsterName = new Label("Alien plant", skin);
        monsterName.setFontScale(1f);
        monster1Table.padBottom(700);
        monster1Table.setFillParent(true);
        monster1Table.add(unlockedImg).size(60, 60).padBottom(20);
        monster1Table.add(monsterName).padLeft(55).padBottom(45);

        BaseEntityConfig config_plant = configs2.plant;
        monster1AttributeTable = new Table();
        Label monsterAttributes = new Label("attack:" + config_plant.baseAttack + "\nhealth:" + config_plant.health, skin);
        monsterAttributes.setColor(255, 255, 255, 0.5f);
        monsterAttributes.setFontScale(0.8f);
        monster1AttributeTable.center().padLeft(90).padBottom(680);
        monster1AttributeTable.setFillParent(true);
        monster1AttributeTable.add(monsterAttributes);

Add background table, monster board table and monster table to the stage

   // add the board to the stage first so that its can be under of score data
        stage.addActor(bgTable);
        stage.addActor(boardTable);
        stage.addActor(monster1Table);

When the picture button is clicked, the openDetailPage function on MonsterDetails.java will be called

   @Override
    public void create() {
        super.create();

        entity.getEvents().addListener("openDetailPage", this::openDetailPage1);
      

    }

The dialog method is used in the openDetailPage1() method to define a pop-up window effect. In this function, head, picture and text are added to the dialog.

   private void openDetailPage1() {
        logger.info("Alien Plant Detail Page");
        dialog = new Dialog("Alien Plant Detail", skin);
        dialog.setModal(true);
        dialog.setMovable(false);
        dialog.setResizable(true);
        Image plantImage = new Image(new Texture("images/monster_menu/plant_img.png"));
        Label heading = new Label("Alien plant Feature: Trigger bounce " , new Label.LabelStyle(new BitmapFont(), Color.BLACK));
        Label story = new Label("This is an alien plant, when the character touches the obstacle, the alien plant will burst into pieces. Then the main character will be slowed down and deducted a certain amount of blood", new Label.LabelStyle(new BitmapFont(), Color.DARK_GRAY));
        heading.setFontScale(2f);
        story.setFontScale(1.3f);
        story.setWrap(true);
        story.setAlignment(Align.topLeft);
        dialog.getContentTable().add(heading).expandX().row();
        dialog.getContentTable().add(plantImage).height(152).width(240).row();
        dialog.getContentTable().add(story).width(600).row();
        dialog.getButtonTable().add(renderCloseButton()).size(50, 50).row();
        Image background = new Image(new Texture("images/monster_menu/box-background.png"));
        background.setScaling(Scaling.fit);
        dialog.setBackground(background.getDrawable());
        dialog.show(stage);
    }

Secret table unlock

The monster menu is locked by default, and the lock attribute returns a true by default. Only the secret table is displayed on the menu. When the character encounters a monster in the game, it will return a false unlock illustration book.

    if (ObstacleEventHandler.locked) {
            stage.addActor(secretTable);
            logger.info("Alien Plant Detail Page Locked");
        }

When the character encounters a monster in the game, it will return a false through the related function to unlock the illustration book.

   void plantsDisappear(Fixture me, Fixture other) {
        if (hitboxComponent.getFixture() != me) {
            // Not triggered by hitbox, ignore
            return;
        }
        if (!PhysicsLayer.contains(PhysicsLayer.PLAYER, other.getFilterData().categoryBits)) {
            // Doesn't match our target layer, ignore
            return;
        }

        if (count == 0) { // Avoid an entity from repeatedly triggering an attack
            count++;

            logger.debug("collisionStart event for {} was triggered.", entity.toString());
            animator.getEntity().setRemoveTexture();
            animator.startAnimation("obstacles");
            animator.getEntity().setDisappearAfterAnimation(1f);
            locked = false;
        }
    }

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