Class MiniMapDisplay

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

public class MiniMapDisplay extends UIComponent
The MiniMapDisplay class is a UI component responsible for displaying a minimap on the screen. It shows the player's position, as well as various entities like enemies, bosses, friendly NPCs, and minigame NPCs, represented by different colored dots. The minimap updates positions based on the entities' world coordinates.
  • Constructor Details

    • MiniMapDisplay

      public MiniMapDisplay()
      Default constructor for MiniMapDisplay. Initializes all entity lists.
    • MiniMapDisplay

      public MiniMapDisplay(GameArea gameArea)
      Constructor that initializes the MiniMapDisplay with a specified GameArea.
      Parameters:
      gameArea - the game area from which to retrieve player and entities.
  • Method Details

    • create

      public void create()
      Creates the minimap, initializing the player and entity lists from the GameArea.
      Overrides:
      create in class UIComponent
    • initializeAllImages

      public void initializeAllImages()
      Initializes all dot images for player, enemies, bosses, friendly NPCs, and minigame NPCs.
    • initializeGreenDotImages

      public void initializeGreenDotImages()
      Initializes the green dot image representing the player on the minimap.
    • initializeRedDotImages

      public void initializeRedDotImages()
      Initializes red dot images for each enemy on the minimap.
    • initializeBlueDotImages

      public void initializeBlueDotImages()
      Initializes blue dot images for friendly NPCs on the minimap.
    • initializeLargeRedPointImages

      public void initializeLargeRedPointImages()
      Initializes large red dot images for bosses on the minimap.
    • initializePurplePointImages

      public void initializePurplePointImages()
      Initializes purple dot images for minigame NPCs on the minimap.
    • transferToMiniMapPos

      public com.badlogic.gdx.math.Vector2 transferToMiniMapPos(Entity entity)
      Transfers the world position of an entity to the corresponding minimap position.
      Parameters:
      entity - the entity to transfer.
      Returns:
      the position of the entity on the minimap.
    • updateAllPoints

      public void updateAllPoints()
      Updates all dot points on the minimap, including enemies, friendly NPCs, bosses, and minigame NPCs.
    • update

      public void update()
      Updates the minimap, adjusting the player and entity positions each frame.
      Overrides:
      update in class Component
    • draw

      protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch)
      Draws the minimap background on the screen.
      Specified by:
      draw in class RenderComponent
      Parameters:
      batch - the sprite batch used for drawing the minimap.
    • getPlayer

      public Entity getPlayer()
      Retrieves the player entity displayed on the minimap.
      Returns:
      the player entity.
    • getMiniMapX

      public float getMiniMapX()
      Gets the X position of the minimap on the screen.
      Returns:
      the X coordinate of the minimap.
    • getMiniMapY

      public float getMiniMapY()
      Gets the Y position of the minimap on the screen.
      Returns:
      the Y coordinate of the minimap.
    • getMiniMapDiameter

      public float getMiniMapDiameter()
      Gets the diameter of the minimap.
      Returns:
      the diameter of the minimap.
    • setMiniMapPosition

      public void setMiniMapPosition(float posX, float posY)
      Sets the position of the minimap on the screen.
      Parameters:
      posX - the new X coordinate for the minimap.
      posY - the new Y coordinate for the minimap.
    • setMiniMapDiameter

      public void setMiniMapDiameter(int size)
      Sets the diameter of the minimap.
      Parameters:
      size - the new diameter for the minimap.