Class MazeMovementUtils

java.lang.Object
com.csse3200.game.minigames.maze.components.tasks.MazeMovementUtils

public class MazeMovementUtils extends Object
Some utility functions to help with movement tasks in the maze.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.badlogic.gdx.math.Vector2
    adjustPos(com.badlogic.gdx.math.Vector2 pos, Entity entity)
    Takes a position relative to the center of an entity and converts it to a position relative to the bottom-left corner of the entity.
    static boolean
    canBeeLineTo(com.badlogic.gdx.math.Vector2 pos, Entity entity)
    Checks whether an entity can beeline to a position considering hitbox collisions and obstacles.
    static com.badlogic.gdx.math.Vector2[]
    getHitBoxCorners(Entity entity, float padding)
    Gets the corners of a rectangle hitbox of an entity adding padding around the box.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • adjustPos

      public static com.badlogic.gdx.math.Vector2 adjustPos(com.badlogic.gdx.math.Vector2 pos, Entity entity)
      Takes a position relative to the center of an entity and converts it to a position relative to the bottom-left corner of the entity.
      Parameters:
      pos - Position relative to center of entity
      entity - The entity
      Returns:
      Position relative to bottom-left of entity
    • getHitBoxCorners

      public static com.badlogic.gdx.math.Vector2[] getHitBoxCorners(Entity entity, float padding)
      Gets the corners of a rectangle hitbox of an entity adding padding around the box.
      Parameters:
      entity - the entity
      padding - the padding to add around the hitbox
      Returns:
      an array of vertices representing the corners of the hitbox
    • canBeeLineTo

      public static boolean canBeeLineTo(com.badlogic.gdx.math.Vector2 pos, Entity entity)
      Checks whether an entity can beeline to a position considering hitbox collisions and obstacles.
      Parameters:
      pos - the target destination
      entity - the entity
      Returns:
      whether the entity can beeline to the target position without hitting and obstacle.