Skip to content

ProgressBarEntity

fff134 edited this page Oct 22, 2017 · 10 revisions

by The Pota2s

Introduction

  • In Potatoes a progress bar is a graphical element used to display the player and enemies health.
  • Progression bars are shown as a solid colour rectangle which transitions between the chosen colours depending on the enemy's health percentage.
  • The only requirement is that the class implements hasProgressBar.
  • ProgressBar as an interface has also been implemented, in case any of the functionality given to display progress bars is required for some other classes.

Implementation:

Possible Construction Inputs:

  • String texture - A string of the texture name
  • List colours - A list of colour or colours to be used for the progress bar. Ordering is important, index 0 is the lowest progress.
  • int height - A integer which is the vertical distance of the progress bar in relation to the location of the entity.
  • float widthScale - A integer which is the scale of the progress bar in relation to its entity.

Construction methods:

  • ProgressBarEntity(List<Color> colours>)

defaults are texture = "progress_bar", height = 0 and widthScale = 1

  • public ProgressBarEntity(String texture, float widthScale)

default are colours = Color.WHITE and height = 0

  • public ProgressBarEntity(String texture, String, layoutTexture, float widthScale)

default are colours = Color.WHITE and height = 0

  • ProgressBarEntity(String texture, List<Color> colours, int height, float widthScale)

Methods:

  • getTexture() Returns a String of the textures name.
  • getColour() Returns colour to display based on the entities health.
  • getColours() Returns a list which contains all the colours.
  • getHeight() Returns the height of the progress bar set to go above the entities.
  • getWidthScale() Returns the width scale of the progress bar in relation to its entity.
  • getLayoutTexture() Returns the Layout UI. Primary used for player and portal.

How do I add a custom progress bar to my enemy entity?

  1. Create a list of colours in your enemy class:

List<Color> colours = Arrays.asList(Color.RED, Color.valueOf("fff134"), new Color(0f, 255f, 0f, 1f));

  1. Create an instance of the ProgressBarEntity class in your enemy class (See Constructor methods above).

  2. Add a getter method in your enemy class:

@Override public ProgressBarEntity getProgressBar() { return progressBar; }


Gameplay

Design

Asset Creation

User Testing

Code Guidelines


http://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gifhttp://cultofthepartyparrot.com/parrots/partyparrot.gif

Clone this wiki locally