Skip to content
Zakru edited this page Jun 15, 2019 · 1 revision

Entity is a supertype for all entities. An entity has a position and a render function, and its state can be updated arbitrarily using events or the Mod:update function.

Static methods

new(world, x,y)

Creates an instance of this type in the specified world and coordinates.

Parameters:

  • world: The World to create the entity in.
  • x, y: The tile position in which to create the entity.

newChild

Shorthand method for creating a new child type. Sets it up with a default new method. The return value of this method is enough for a renderable entity.

Methods

move(x,y)

Utility method. Attempts to move the entity in the world by the specified tile offset. Fails if the target tile is empty or its isWalkable returns false.

Parameters:

  • x, y: The offset in tiles to move the entity.

Callback methods

draw(graphics, x,y)

Called during love.draw in order to draw this entity. The default method draws the entity's texture in the given coordinates.

Parameters:

  • graphics: love.graphics. This will be wrapped in the future for safety and better integration.
  • x, y: The screen coordinates of the top-left corner of the tile in which this entity currently is.
Clone this wiki locally