reference monoe.entity

Lua API Reference

Represents a 2D game entity that can hold sprites, animations, or other attached objects.

Properties

NameTypeDescription
uidintegerUnique engine-side identifier for this entity
zindexinteger

monoe.entity.new

Creates a new `monoe.entity` instance. This entity can be positioned, scaled, moved, and have other objects attached.

Returns


monoe.entity:position

Gets or sets the position of the entity in 2D space. If `x` and `y` are provided, the entity is moved to that position.

Parameters

NameTypeDescription
xnumber|nilX-coordinate to set (optional)
ynumber|nilY-coordinate to set (optional)

Returns


monoe.entity:move

Moves the entity by applying a velocity. Automatically calls `MoveAndSlide` to update the entity's position according to physics rules.

Parameters

NameTypeDescription
xnumberHorizontal velocity
ynumberVertical velocity

monoe.entity:scale

Scales the entity in X and Y directions.

Parameters

NameTypeDescription
xnumberScale factor along the X-axis
ynumberScale factor along the Y-axis

Returns


monoe.entity:free

Releases engine resources used by this entity. After calling this, the entity should no longer be used.


monoe.entity:remove

Removes the instance from the rendering side.


monoe.entity:attach

Attaches another object (sprite, animation, or another entity) to this entity. The attached object will move and scale with the entity.

Parameters

NameTypeDescription
objmonoe.image|monoe.sprite|monoe.animation|monoe.entityObject to attach