Class Spawnpoint
java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.Spawnpoint
- All Implemented Interfaces:
EntityRenderedListener
,EntityRenderListener
,IEntity
,Tweenable
,java.util.EventListener
public class Spawnpoint
extends Entity
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Spawnpoint.EntitySpawnedListener
Field Summary
Constructor Summary
Constructors Constructor Description Spawnpoint()
Instantiates a newSpawnpoint
entity.Spawnpoint(double x, double y)
Instantiates a newSpawnpoint
entity.Spawnpoint(double x, double y, Direction direction)
Spawnpoint(int mapId, double x, double y)
Instantiates a newSpawnpoint
entity.Spawnpoint(int mapId, double x, double y, Direction direction)
Instantiates a newSpawnpoint
entity.Spawnpoint(int mapId, java.awt.geom.Point2D location)
Instantiates a newSpawnpoint
entity.Spawnpoint(int mapId, java.awt.geom.Point2D location, Direction direction)
Instantiates a newSpawnpoint
entity.Spawnpoint(Direction direction)
Instantiates a newSpawnpoint
entity.Spawnpoint(Direction direction, java.lang.String spawnType)
Instantiates a newSpawnpoint
entity.Spawnpoint(java.awt.geom.Point2D location)
Spawnpoint(java.awt.geom.Point2D location, Direction direction)
Method Summary
Modifier and Type Method Description Direction
getDirection()
java.lang.String
getSpawnInfo()
double
getSpawnOffsetX()
double
getSpawnOffsetY()
EntityPivotType
getSpawnPivotType()
void
onSpawned(Spawnpoint.EntitySpawnedListener listener)
Adds the specified entity spawned listener to receive events when entities are spawned by this instance.void
removeSpawnedListener(Spawnpoint.EntitySpawnedListener listener)
Removes the specified entity spawned listener.void
setDirection(Direction direction)
void
setSpawnInfo(java.lang.String spawnInfo)
void
setSpawnOffsetX(double spawnOffsetX)
void
setSpawnOffsetY(double spawnOffsetY)
void
setSpawnPivotType(EntityPivotType spawnPivotType)
boolean
spawn(IEntity entity)
Spawns the specified entity to theEnvironment
of theSpawnpoint
or the currently activeEnvironment
.Methods inherited from class de.gurkenlabs.litiengine.entities.Entity
actions, addController, addEntityRenderListener, addListener, addTag, addTransformListener, animations, attachControllers, behavior, canRender, detachControllers, getAngle, getBoundingBox, getCenter, getController, getControllers, getEnvironment, getHeight, getLocation, getMapId, getName, getProperties, getRenderType, getTags, getTweenValues, getWidth, getX, getY, hasTag, isLoaded, isVisible, loaded, onMessage, onMessage, onRendered, perform, register, removed, removeListener, removeListener, removeListener, removeListener, removeListener, removeTag, rendered, rendering, renderWithLayer, sendMessage, setAngle, setController, setHeight, setLocation, setLocation, setMapId, setName, setRenderType, setRenderWithLayer, setSize, setTweenValues, setVisible, setWidth, setX, setY, toString
Constructor Details
Spawnpoint
public Spawnpoint()Instantiates a newSpawnpoint
entity.Spawnpoint
public Spawnpoint(double x, double y)Instantiates a newSpawnpoint
entity.- Parameters:
x
- The x-coordinate of this instance.y
- The y-coordinate of this instance.
Spawnpoint
public Spawnpoint(java.awt.geom.Point2D location)Spawnpoint
Spawnpoint
Spawnpoint
public Spawnpoint(int mapId, double x, double y)Instantiates a newSpawnpoint
entity.- Parameters:
mapId
- The map id of this instance.x
- The x-coordinate of this instance.y
- The y-coordinate of this instance.
Spawnpoint
public Spawnpoint(int mapId, java.awt.geom.Point2D location)Instantiates a newSpawnpoint
entity.- Parameters:
mapId
- The map id of this instance.location
- The location of this instance.
Spawnpoint
Instantiates a newSpawnpoint
entity.- Parameters:
mapId
- The map id of this instance.x
- The x-coordinate of this instance.y
- The y-coordinate of this instance.direction
- The direction in which entities will be spawned by this instance.
Spawnpoint
Instantiates a newSpawnpoint
entity.- Parameters:
mapId
- The map id of this instance.location
- The location of this instance.direction
- The direction in which entities will be spawned by this instance.
Spawnpoint
Instantiates a newSpawnpoint
entity.- Parameters:
direction
- The direction in which entities will be spawned by this instance.
Spawnpoint
Instantiates a newSpawnpoint
entity.- Parameters:
direction
- The direction in which entities will be spawned by this instance.spawnType
- The type that defines additional information about the entities spawned by this instance.
Method Details
onSpawned
Adds the specified entity spawned listener to receive events when entities are spawned by this instance.- Parameters:
listener
- The listener to add.
removeSpawnedListener
Removes the specified entity spawned listener.- Parameters:
listener
- The listener to remove.
getDirection
setDirection
getSpawnInfo
public java.lang.String getSpawnInfo()setSpawnInfo
public void setSpawnInfo(java.lang.String spawnInfo)getSpawnPivotType
setSpawnPivotType
getSpawnOffsetX
public double getSpawnOffsetX()setSpawnOffsetX
public void setSpawnOffsetX(double spawnOffsetX)getSpawnOffsetY
public double getSpawnOffsetY()setSpawnOffsetY
public void setSpawnOffsetY(double spawnOffsetY)spawn
Spawns the specified entity to theEnvironment
of theSpawnpoint
or the currently activeEnvironment
.Spawning will set the location of the entity to the location defined by the spawnpoint and optionally also set the angle of the entity, if a spawn direction is defined.
- Parameters:
entity
- The entity to spawn at the specified location.- Returns:
- True if the entity was spawned; otherwise false, which is typically the case if no environment is loaded.
- See Also:
GameWorld.environment()