-
Notifications
You must be signed in to change notification settings - Fork 4
ProgressBarEntity
fff134 edited this page Oct 22, 2017
·
10 revisions
- 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.
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.
- 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));
-
Create an instance of the ProgressBarEntity class in your enemy class (See Constructor methods above).
-
Add a getter method in your enemy class:
@Override public ProgressBarEntity getProgressBar() { return progressBar; }
- Home
- How To Play
- Keybindings
- Inventory and Resources
- Trees
- Portals and Worlds
- Projectiles
- Enemies
- Waves & Spawning
- Graphical assets progress overview
- Audio Files
- Design Templates
- Blender Intro
- Converting 3D models to Sprites
- Scripting in Blender
- Creating a Model in Sketchup
- Colouring and Animating in Blender
- Animation using Dope Sheet, Keyframes and Scale Transformation in Blender
- Template
- Testing
- Terrain
- Terrain Generation
- Resource Trees
- Main Menu, Chat, options
- Main Menu V2, Options V2, Sound
- Damage Trees
- Projectiles
- Enemy User Testing
- Tree planting, inventory GUI, resources, portals
- Caveman Character
- Debug Mode Menu
- Tree learning, Attack Trees, Main Menu Tutorial Resources Styling
- Revamped Resource Trees
- Squirrel User Testing
- Final evaluation
- Project Structure
- Git Workflow
- GUI
- Worlds
- Entity Directions
- Resources
- Inventory
- AbstractEntities
- BasicProperties
- MortalEntity
- ProgressBarEntity
- Multiplayer
- Trees
- TimeEvent
- Game Time
- Animations
- Enemies
- Waves
- Player
- Projectiles
- Effect
- Particles
- Path Manager
- Sounds
- Debug 'God' Mode
- 2D Collision
- Box3D {depreciated}
- Render3D
- Cheat Codes