Class SpeedBootsUpgrade

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, Upgrade, Renderable, Comparable<Renderable>

public class SpeedBootsUpgrade extends UIComponent implements Upgrade
Manages the Speed Boots Upgrade UI component, handling activation, deactivation, visual updates, and related sound effects. when activated, makes player move twice as fast
  • Field Details

    • greenTexture

      public static final String[] greenTexture
    • whiteBgTexture

      public static final String[] whiteBgTexture
    • layout

      public com.badlogic.gdx.scenes.scene2d.ui.Table layout
    • text

      public com.badlogic.gdx.scenes.scene2d.ui.Label text
    • speedMeter

      public com.badlogic.gdx.scenes.scene2d.ui.ProgressBar speedMeter
  • Constructor Details

  • Method Details

    • create

      public void create()
      Description copied from class: Component
      Called when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished.
      Overrides:
      create in class UIComponent
    • activate

      public void activate()
      Activates the speed boost if conditions are met (e.g., sufficient gold). Deducts the cost, updates player speed, and displays the UI.
      Specified by:
      activate in interface Upgrade
    • deactivate

      public void deactivate()
      Deactivates the speed boost, resetting player speed and hiding the UI. Cleans up UI elements and resets relevant flags.
      Specified by:
      deactivate in interface Upgrade
    • update

      public void update()
      Updates the SpeedBootsUpgrade component each frame, managing the countdown timer and handling deactivation when the boost duration expires.
      Overrides:
      update in class Component
    • speedCost

      public void speedCost()
      Decrement cost when speed boot is activate.
    • dispose

      public void dispose()
      Description copied from class: Component
      Called when the component is disposed. Dispose of any internal resources here.
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable
      Overrides:
      dispose in class RenderComponent
    • draw

      protected void draw(com.badlogic.gdx.graphics.g2d.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.
    • setStage

      public void setStage(com.badlogic.gdx.scenes.scene2d.Stage mock)
      Specified by:
      setStage in interface Renderable
    • getNormalSpeed

      public float getNormalSpeed()
    • getBoostedSpeed

      public float getBoostedSpeed()
    • isActivate

      public boolean isActivate()
    • isVisible

      public boolean isVisible()
    • getActiveTimeRemaining

      public float getActiveTimeRemaining()
    • getBoostDuration

      public long getBoostDuration()
    • getBoostStartTime

      public long getBoostStartTime()
    • getPlaySound

      public boolean getPlaySound()