Package com.deco2800.game.services
Class RangeService
java.lang.Object
com.deco2800.game.services.RangeService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.badlogic.gdx.math.GridPoint2
This function returns whats in the UGS in the tile where the player is standing.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)playerInRangeOf
(Entity toCompare) 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
-
Constructor Details
-
RangeService
public RangeService()
-
-
Method Details
-
perimeter
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
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
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
-