-
class Actor :
Entity
¶ An ‘Actor’ represents entities in the game, including the player, enemies, and items. Actors are composed of Components that define their state and behavior. For example, an actor may have a Sight component that determines their field of vision, explored tiles, and other related aspects.
-
__new(self:
Actor
)¶ Constructor for an actor. Initializes and copies the actor’s fields from its prototype.
-
staticmethod fromComponents(components:
Component
[]) actor:Actor
¶ Initializes an actor from a list of components.
-
getActions(self:
Actor
) totalActions:Action
[] ¶ Get a list of actions that the actor can perform.
- Returns:
totalActions (
Action
[]) – A table of all actions.
-
getPosition(self:
Actor
, out?:Vector2
) position?:Vector2
¶ Returns the current position of the actor
-
getRange(self:
Actor
, actor:Actor
, type?: "4way" | "8way" | "chebyshev" | "euclidean" | "manhattan")number
¶ Get the range from this actor to another actor.
- Parameters:
actor (
Actor
) – The other actor to get the range to.- Returns:
_1 (
number
) – The calculated range.
-
getRangeVec(self:
Actor
, vector:Vector2
, type?: "4way" | "8way" | "chebyshev" | "euclidean" | "manhattan")number
¶ Get the range from this actor to a given vector.
- Parameters:
vector (
Vector2
) – The vector to get the range to.type? ("4way" | "8way" | "chebyshev" | "euclidean" | "manhattan") – The type of range calculation to use.
- Returns:
_1 (
number
) – The calculated range.
-
__new(self: