Health - OxiStudios/OrbMain GitHub Wiki

Intro

Health has two main aspects in a game. The first is the actual variable, the easier aspect out of the two. The second is the way the game displays the variable on screen, which is a little bit harder than the first. It is not necessarily a super hard concept, but is a little different than what I first thought it was going to be.

Health Class

  • The Health class will be responsible for taking in things that will affect saveFile.health.
  • Things that I think that will affect the health is the level of the player, or an ability.
  • The most important thing about the health class is the sprite for displaying the health.
  • The sprite will be called in the UI class so that the sprite will be put into the right place on the screen.
  • There will be a method called render(),setSprite(),getMasterSprite(),getActualHealth()
  • getActualHealth() will return the health with the buffs, not just saveFile.health

The Sprite

  • The sprite will be changed according to the what level the health is at.
  • The UI class that holds the table for the stats on screen will call getMasterSprite
  • There will be 10 sprites that the masterSprite can be.

Render/setSprite Methods

  • render() will run setSprite()
  • setSprite() will be a switch case statement that will be incremented by 10's and will set masterSprite() to the correct sprite.