Class FoodDisplay

All Implemented Interfaces:
Disposable, Renderable, java.lang.Comparable<Renderable>

public class FoodDisplay
extends UIComponent
A ui component for displaying food system. Player lose a chicken for 3 sec
  • Field Details

  • Constructor Details

  • Method Details

    • create

      public void create()
      Creates reusable food ui styles and adds actors to the stage. And starts the counting the time.
      Overrides:
      create in class UIComponent
    • draw

      public void draw​(SpriteBatch batch)
      Description copied from class: RenderComponent
      Draw the renderable. Should be called only by the renderer, not manually.
      Specified by:
      draw in class RenderComponent
      Parameters:
      batch - Batch to render to.
    • update

      public void update()
      Reduce food when time increase
      Overrides:
      update in class Component
    • updatePlayerHealth

      public void updatePlayerHealth​(int dis)
    • updatePlayerTimerUI

      public void updatePlayerTimerUI​(int dis)
      Updates the Chicken ui time by time increase.
    • dispose

      public void dispose()
      remove foodImage by useing a for loop
      Specified by:
      dispose in interface Disposable
      Overrides:
      dispose in class RenderComponent
    • getHunger

      public java.util.ArrayList<Image> getHunger()
      return the foodImage
    • addOrRemoveImage

      public static void addOrRemoveImage​(int value)
      Add/remove a image
      Parameters:
      value - = 1, add a image;
      value - = -1, remove a image
    • isHunger

      public static boolean isHunger()
      when player have no food, this function will return true