Class Spawnpoint

java.lang.Object
de.gurkenlabs.litiengine.entities.Entity
de.gurkenlabs.litiengine.entities.Spawnpoint
All Implemented Interfaces:
EntityRenderedListener, EntityRenderListener, IEntity, Tweenable, EventListener

public class Spawnpoint extends Entity
  • Constructor Details

    • Spawnpoint

      public Spawnpoint()
      Instantiates a new Spawnpoint entity.
    • Spawnpoint

      public Spawnpoint(double x, double y)
      Instantiates a new Spawnpoint entity.
      Parameters:
      x - The x-coordinate of this instance.
      y - The y-coordinate of this instance.
    • Spawnpoint

      public Spawnpoint(Point2D location)
    • Spawnpoint

      public Spawnpoint(double x, double y, Direction direction)
    • Spawnpoint

      public Spawnpoint(Point2D location, Direction direction)
    • Spawnpoint

      public Spawnpoint(int mapId, double x, double y)
      Instantiates a new Spawnpoint 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, Point2D location)
      Instantiates a new Spawnpoint entity.
      Parameters:
      mapId - The map id of this instance.
      location - The location of this instance.
    • Spawnpoint

      public Spawnpoint(int mapId, double x, double y, Direction direction)
      Instantiates a new Spawnpoint 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

      public Spawnpoint(int mapId, Point2D location, Direction direction)
      Instantiates a new Spawnpoint 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

      public Spawnpoint(Direction direction)
      Instantiates a new Spawnpoint entity.
      Parameters:
      direction - The direction in which entities will be spawned by this instance.
    • Spawnpoint

      public Spawnpoint(Direction direction, String spawnType)
      Instantiates a new Spawnpoint 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

      public void onSpawned(Spawnpoint.EntitySpawnedListener listener)
      Adds the specified entity spawned listener to receive events when entities are spawned by this instance.
      Parameters:
      listener - The listener to add.
    • removeSpawnedListener

      public void removeSpawnedListener(Spawnpoint.EntitySpawnedListener listener)
      Removes the specified entity spawned listener.
      Parameters:
      listener - The listener to remove.
    • getDirection

      public Direction getDirection()
      Gets the direction in which entities will be spawned by this instance.
      Returns:
      the spawn direction
    • setDirection

      public void setDirection(Direction direction)
      Sets the direction in which entities will be spawned by this instance.
      Parameters:
      direction - the new spawn direction
    • getSpawnInfo

      public String getSpawnInfo()
      Gets the spawn information for this instance.
      Returns:
      the spawn information
    • setSpawnInfo

      public void setSpawnInfo(String spawnInfo)
      Sets the spawn information for this instance.
      Parameters:
      spawnInfo - the new spawn information
    • getSpawnPivotType

      public EntityPivotType getSpawnPivotType()
      Gets the spawn pivot type for this instance.
      Returns:
      the spawn pivot type
    • setSpawnPivotType

      public void setSpawnPivotType(EntityPivotType spawnPivotType)
      Sets the spawn pivot type for this instance.
      Parameters:
      spawnPivotType - the new spawn pivot type
    • getSpawnOffsetX

      public double getSpawnOffsetX()
      Gets the spawn offset on the X-axis for this instance.
      Returns:
      the spawn offset on the X-axis
    • setSpawnOffsetX

      public void setSpawnOffsetX(double spawnOffsetX)
      Sets the spawn offset on the X-axis for this instance.
      Parameters:
      spawnOffsetX - the new spawn offset on the X-axis
    • getSpawnOffsetY

      public double getSpawnOffsetY()
      Gets the spawn offset on the Y-axis for this instance.
      Returns:
      the spawn offset on the Y-axis
    • setSpawnOffsetY

      public void setSpawnOffsetY(double spawnOffsetY)
      Sets the spawn offset on the Y-axis for this instance.
      Parameters:
      spawnOffsetY - the new spawn offset on the Y-axis
    • spawn

      public boolean spawn(IEntity entity)
      Spawns the specified entity to the Environment of the Spawnpoint or the currently active Environment.

      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: