-
Notifications
You must be signed in to change notification settings - Fork 4
Entity
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.
Creates an instance of this type in the specified world and coordinates.
Parameters:
-
world
: TheWorld
to create the entity in. -
x
,y
: The tile position in which to create the entity.
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.
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.
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.