Class MapSector
- java.lang.Object
-
- net.egartley.beyondorigins.core.abstracts.MapSector
-
-
Field Summary
Fields Modifier and Type Field Description static byte
BOTTOM
private short
BOUNDARY_SIZE
protected java.util.ArrayList<MapSectorChangeBoundary>
changeBoundaries
private java.util.ArrayList<MapSectorChangeCollision>
changeCollisions
private int
deltaX
private int
deltaY
java.util.ArrayList<Entity>
entities
static byte
LEFT
private byte
MAX_NEIGHBORS
private java.util.ArrayList<MapSector>
neighbors
int
number
protected Map
parent
private short
PLAYER_ENTRANCE_OFFSET
java.util.ArrayList<Entity>
primaryEntities
java.util.ArrayList<Renderable>
renderables
static byte
RIGHT
java.util.ArrayList<Tickable>
tickables
static short
TILE_COLUMNS
static short
TILE_ROWS
private short
TILE_SIZE
protected java.util.ArrayList<java.util.ArrayList<MapTile>>
tiles
static byte
TOP
-
Constructor Summary
Constructors Constructor Description MapSector(Map parent, int number)
Creates a new map sector, then callsbuildTiles()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addEntity(Entity e)
void
addEntity(Entity e, boolean primary)
void
addRenderable(Renderable renderable)
void
addTickable(Tickable tickable)
private void
buildTiles()
protected void
drawTiles(org.newdawn.slick.Graphics graphics)
Renders all of the sector's tilesprivate void
fill(java.lang.String id)
abstract void
init()
private void
mixed(org.json.JSONArray custom, java.util.ArrayList<java.lang.String> tileIDs, java.util.ArrayList<java.lang.String> tileKeys)
abstract void
onPlayerEnter(MapSector from)
void
onPlayerEnter_internal()
abstract void
onPlayerLeave(MapSector to)
void
onPlayerLeave_internal()
private void
playerEnteredFrom(int direction)
Update, or "correct", the player's position based on what direction it came fromvoid
removeEntity(Entity e)
void
removeEntity(Entity e, boolean primary)
void
removeRenderable(Renderable renderable)
void
removeTickable(Tickable tickable)
void
render(org.newdawn.slick.Graphics graphics)
Minimum requirement for rendering, must be called first in any implementationvoid
setNeighborAt(MapSector neighbor, byte direction)
Sets a neighboring sector in the direction, as well as reciprocating itprivate void
setNeighborAt(MapSector neighbor, byte direction, boolean didSetInverse)
abstract void
setSpecialCollisions()
Set sector-specific, or "special" collisions, such as ones that have to do with a questvoid
tick()
Minimum requirement for each tick, must be called first in any implementationjava.lang.String
toString()
protected void
updatePlayerPosition(MapSector from)
Updates the player's position in accordance with the sector they just came from
-
-
-
Field Detail
-
deltaX
private int deltaX
-
deltaY
private int deltaY
-
MAX_NEIGHBORS
private final byte MAX_NEIGHBORS
- See Also:
- Constant Field Values
-
TILE_SIZE
private final short TILE_SIZE
- See Also:
- Constant Field Values
-
BOUNDARY_SIZE
private final short BOUNDARY_SIZE
- See Also:
- Constant Field Values
-
PLAYER_ENTRANCE_OFFSET
private final short PLAYER_ENTRANCE_OFFSET
- See Also:
- Constant Field Values
-
neighbors
private final java.util.ArrayList<MapSector> neighbors
-
changeCollisions
private final java.util.ArrayList<MapSectorChangeCollision> changeCollisions
-
parent
protected Map parent
-
tiles
protected java.util.ArrayList<java.util.ArrayList<MapTile>> tiles
-
changeBoundaries
protected java.util.ArrayList<MapSectorChangeBoundary> changeBoundaries
-
number
public int number
-
TOP
public static final byte TOP
- See Also:
- Constant Field Values
-
RIGHT
public static final byte RIGHT
- See Also:
- Constant Field Values
-
BOTTOM
public static final byte BOTTOM
- See Also:
- Constant Field Values
-
LEFT
public static final byte LEFT
- See Also:
- Constant Field Values
-
TILE_ROWS
public static final short TILE_ROWS
- See Also:
- Constant Field Values
-
TILE_COLUMNS
public static final short TILE_COLUMNS
- See Also:
- Constant Field Values
-
entities
public java.util.ArrayList<Entity> entities
-
primaryEntities
public java.util.ArrayList<Entity> primaryEntities
-
renderables
public java.util.ArrayList<Renderable> renderables
-
tickables
public java.util.ArrayList<Tickable> tickables
-
-
Constructor Detail
-
MapSector
public MapSector(Map parent, int number)
Creates a new map sector, then callsbuildTiles()
-
-
Method Detail
-
init
public abstract void init()
-
render
public void render(org.newdawn.slick.Graphics graphics)
Minimum requirement for rendering, must be called first in any implementation
-
drawTiles
protected void drawTiles(org.newdawn.slick.Graphics graphics)
Renders all of the sector's tiles- Parameters:
graphics
- The graphics to use
-
buildTiles
private void buildTiles()
-
fill
private void fill(java.lang.String id)
-
mixed
private void mixed(org.json.JSONArray custom, java.util.ArrayList<java.lang.String> tileIDs, java.util.ArrayList<java.lang.String> tileKeys)
-
tick
public void tick()
Minimum requirement for each tick, must be called first in any implementation
-
onPlayerEnter_internal
public void onPlayerEnter_internal()
-
onPlayerLeave_internal
public void onPlayerLeave_internal()
-
setSpecialCollisions
public abstract void setSpecialCollisions()
Set sector-specific, or "special" collisions, such as ones that have to do with a quest
-
onPlayerEnter
public abstract void onPlayerEnter(MapSector from)
-
onPlayerLeave
public abstract void onPlayerLeave(MapSector to)
-
updatePlayerPosition
protected void updatePlayerPosition(MapSector from)
Updates the player's position in accordance with the sector they just came from- Parameters:
from
- Where the player is coming from
-
playerEnteredFrom
private void playerEnteredFrom(int direction)
Update, or "correct", the player's position based on what direction it came from
-
addEntity
public void addEntity(Entity e)
-
addEntity
public void addEntity(Entity e, boolean primary)
-
removeEntity
public void removeEntity(Entity e)
-
removeEntity
public void removeEntity(Entity e, boolean primary)
-
addTickable
public void addTickable(Tickable tickable)
-
removeTickable
public void removeTickable(Tickable tickable)
-
addRenderable
public void addRenderable(Renderable renderable)
-
removeRenderable
public void removeRenderable(Renderable renderable)
-
setNeighborAt
public void setNeighborAt(MapSector neighbor, byte direction)
Sets a neighboring sector in the direction, as well as reciprocating it
-
setNeighborAt
private void setNeighborAt(MapSector neighbor, byte direction, boolean didSetInverse)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- parent, sector index
- See Also:
parent
-
-