Class RangeService

java.lang.Object
com.deco2800.game.services.RangeService

public class RangeService extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    com.badlogic.gdx.math.GridPoint2
    This function returns whats in the UGS in the tile where the player is standing.
    perimeter(Entity middle, com.badlogic.gdx.math.GridPoint2 gridPos)
    This function allows you to pass in an entity and retrieve an array containing every entity store in the UGS that are in the 8 squares around it + the players square: (Under Player, Top Left, Directly Above, Top Right, Right, Bottom Right, Directly Bellow, Bottom Left, Left)
    This function allows the user to check if an entity is in range of the player.
    This function filters through the UGS and returns a list of all entities that are registered in the UGS

    Methods inherited from class java.lang.Object

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

    • RangeService

      public RangeService()
  • Method Details

    • perimeter

      public ArrayList<Entity> perimeter(Entity middle, com.badlogic.gdx.math.GridPoint2 gridPos)
      This function allows you to pass in an entity and retrieve an array containing every entity store in the UGS that are in the 8 squares around it + the players square: (Under Player, Top Left, Directly Above, Top Right, Right, Bottom Right, Directly Bellow, Bottom Left, Left)
      Parameters:
      middle - the entity whose perimeter you want to find
      Returns:
      an array list containing the perimeter in the form above
    • getPlayerTile

      public com.badlogic.gdx.math.GridPoint2 getPlayerTile()
      This function returns whats in the UGS in the tile where the player is standing. This is a short term solution to the enemies not yet moving in the UGS.
      Returns:
      the string generated key that is stored in the hashmap of where the player is standing
    • registeredInUGS

      public ArrayList<Entity> registeredInUGS()
      This function filters through the UGS and returns a list of all entities that are registered in the UGS
      Returns:
      an array containing all entities that are within the UGS
    • playerInRangeOf

      public Boolean playerInRangeOf(Entity toCompare)
      This function allows the user to check if an entity is in range of the player. So enemies can use this to attack etc.
      Parameters:
      toCompare - an entity that you want to see if its around the player
      Returns:
      true if its within the players perimeter and false if its not