class Tool: Object
__new(self: Object, ...: any)

The default constructor for the class. Subclasses should override this.

update(self: Tool, dt: number, editor: Editor)

Updates the tool state.

Parameters:
  • dt (number) – The time delta since the last update.

  • editor (Editor) – The editor instance.

draw(self: Tool, editor: Editor, display: Display)

Draws the tool visuals.

getDrawable(
    self: Tool,
    placeable: {entity: Entity, factory: fun(): Entity}
): Drawable

Returns the Drawable from placeable

drawCell(
    self: Tool,
    display: Display,
    drawable: Drawable,
    x: integer,
    y: integer
)

Draws a cell at the given coordinates.

mouseclicked(
    self: Tool,
    editor: Editor,
    level: any,
    cellx: number,
    celly: number
)

Handles mouse click events.

Parameters:
  • cellx (number) – The x-coordinate of the cell clicked.

  • celly (number) – The y-coordinate of the cell clicked.

mousereleased(
    self: Tool,
    editor: Editor,
    level: any,
    cellx: number,
    celly: number
)

Handles mouse release events.

Parameters:
  • cellx (number) – The x-coordinate of the cell release.

  • celly (number) – The y-coordinate of the cell release.

overrideCellDraw(
    self: Tool,
    editor: Editor,
    level: Level,
    cellx: integer,
    celly: integer
)