Package com.mygdx.auber.entities
Class Prisoners
- java.lang.Object
-
- com.mygdx.auber.entities.Prisoners
-
public class Prisoners extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Prisoners(com.badlogic.gdx.maps.tiled.TiledMapTileLayer layer)Class constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidaddPrisoner(com.badlogic.gdx.graphics.g2d.Sprite sprite)Adds a prisoner to the list of prisoners and spawns them in the brig.static voidaddPrisoner(com.badlogic.gdx.graphics.g2d.Sprite sprite, int x, int y)Adds a prisoner to the list of prisoners at a specific location.static java.lang.Stringencode()Encodes the prisoners to a string for saving.static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2>findBrigLocations(com.badlogic.gdx.maps.tiled.TiledMapTileLayer tileLayer)Scans every tile and adds a vector2 with the position of the tile with the property "prison".static voidloadFromString(java.lang.String value1)Loads the prisoners from a string.static voidrender(com.badlogic.gdx.graphics.g2d.Batch batch)Renders the sprites in the prison.
-
-
-
Method Detail
-
findBrigLocations
public static com.badlogic.gdx.utils.Array<com.badlogic.gdx.math.Vector2> findBrigLocations(com.badlogic.gdx.maps.tiled.TiledMapTileLayer tileLayer)
Scans every tile and adds a vector2 with the position of the tile with the property "prison".- Parameters:
tileLayer- Layer to scan for tiles- Returns:
- Array of positions of tiles
-
addPrisoner
public static void addPrisoner(com.badlogic.gdx.graphics.g2d.Sprite sprite)
Adds a prisoner to the list of prisoners and spawns them in the brig.- Parameters:
sprite- Sprite of npc to put in prison
-
addPrisoner
public static void addPrisoner(com.badlogic.gdx.graphics.g2d.Sprite sprite, int x, int y)Adds a prisoner to the list of prisoners at a specific location.- Parameters:
sprite- The sprite of the NPC to place in prison.x- The x position to place the NPC at.y- The y position to place the NPC at.
-
render
public static void render(com.badlogic.gdx.graphics.g2d.Batch batch)
Renders the sprites in the prison.- Parameters:
batch- Batch to draw the sprites in
-
encode
public static java.lang.String encode()
Encodes the prisoners to a string for saving.- Returns:
- The prisoners, encoded as a string.
-
loadFromString
public static void loadFromString(java.lang.String value1)
Loads the prisoners from a string.- Parameters:
value1- The string to load the prisoners from.
-
-