Skip to content

Player UI

Rodger Xiang edited this page Sep 10, 2021 · 6 revisions

Low Health: Overview

When the player is damaged below 30% hp, UI changes are triggered. the opacity of the bloody view starts off low and gradually increases as the players hp gets lower. A little heart beat sound is also played when the player reaches 30% of max hp and is triggered in the same way as the bloody view. Done through a new Class PlayerLowHealthDisplay UI component, which uses events to trigger the display of the bloody view. this component is attached to the player Entity in the PlayerFactory.java.

Design Plan

To find the design plan of the bloody view click here

Code Structure

since the players visual HP was updated through the UpdatePlayerHealthUI() it was decided that we would use this method to check for current HP values. This then allowed us to attach event triggers in this class and use another method, updateLowHeathUI() to trigger any event listeners in the PlayerLowHealthDisplay class.

Sequence Diagram

The sequence diagram below shows which how events are triggered depending on the HP of the player:

  1. If player hp <= threshold trigger "BloodyViewOn"
  2. otherwise trigger "BloodyViewOff"

The corresponding event handler will call the respective methods in PlayerLowHealthDisplay to turn on and off the bloody view and the heart beat sound.

Improvements

  • gradually increase the contrast of the bloody view as hp reaches 0. ✔️

  • flash/darken the contrast of the bloody UI every time the player is hit. for Example:

Table of Contents

Home

Design Document

Design Document

Design Document

Game Engine

Getting Started

Entities and Components

Item Drops from Entities

Service Locator

Loading Resources

Logging

Unit Testing

Debug Terminal

Input Handling

UI

Animations

Audio

AI

Physics

Game Screens and Areas

Terrain

Map Generation

Concurrency & Threading

Settings

Troubleshooting

MacOS Setup Guide

Clone this wiki locally