Skip to main content
The Block class represents a single block in the RollingQuest game world — the fundamental building unit that the ball rolls across. Scripts attached to a block receive it as self in hooks such as OnBallRoll and OnBallLand. From a Block reference you can inspect every side and neighboring block, read movement state, toggle tangibility, and mark the block as visited.
Related types: Each side of a block is a Side instance. The block’s grid position is described by a BlockSlot. The raw data representation used at level-build time is BlockData.

Identity

Transform

Sides

Each face of the block is exposed as a direct property and also via getSide.

Neighbors

State

Methods

getSide

Returns the Side corresponding to the given Face enum value. Useful when the face is determined at runtime.

markAsVisited

Programmatically marks the block as visited without requiring the ball to roll over it.

enable / disable

Enable or disable the block entirely. A disabled block is removed from play until re-enabled.

Type-cast helpers

Call these to narrow a generic entity reference to a specific type. Each throws an error if the cast is invalid.

BlockData

BlockData is the raw, mutable representation of a block used when building or modifying level data (e.g. in OnLevelLoad). It holds the grid coordinates x, y, z, a SideData for each of the six faces (up, down, left, right, front, back), and the scripting fields template, scriptRef, scriptTag, scriptVars, and properties. Key BlockData methods:
  • getSides() — returns a table of all six SideData values in order: Up, Down, Left, Right, Front, Back.
  • getSidesIterator() — returns an iterator-compatible version of the same sequence.
  • clear() — resets the block data to empty defaults.

BlockSlot

BlockSlot identifies a block’s integer grid coordinate (x, y, z) within a section. You can obtain the world-space Vector3 from slot.position. Use BlockSlot.new(x, y, z) to construct a slot, and slot:translate(dx, dy, dz) or slot:translateFromBasis(basis, dx, dy, dz) to compute offsets.

Custom Events

Several Block sub-classes emit built-in custom events. Listen for them with the OnCustomEvent hook and dispatch on event.name.

Usage Example

The OnBallRoll hook fires each time the ball moves onto a new side. The example below disables a block when it has been visited three times by incrementing a counter stored in localData: