Ball class represents the player-controlled ball entity in a RollingQuest level. You receive a Ball instance as the self parameter in ball-specific hooks such as OnUpdate, OnLand, and OnJump. Through it you can read the ball’s current state, change movement behaviour, manage linked balls, apply status effects, and kill the ball with a custom cause.
Identity
| Property | Type | Read-only | Description |
|---|---|---|---|
type | EntityType | ✅ | Always EntityType.Ball (5). |
name | string | ✅ | The unique identifier assigned to this ball. |
tag | string | ✅ | The tag associated with the ball, used for grouping or lookup. |
skin | integer | ✅ | The skin ID currently applied to the ball. |
Transform
| Property | Type | Read-only | Description |
|---|---|---|---|
position | Vector3 | ✅ | World-space position of the ball. |
rotation | Quaternion | ✅ | World-space rotation of the ball. |
basis | Basis | ✅ | The current orientation basis of the ball. |
State
| Property | Type | Read-only | Description |
|---|---|---|---|
blockSlot | BlockSlot | ✅ | The grid slot the ball currently occupies. |
section | string | ✅ | ID of the level section the ball is in. |
isAlive | boolean | ✅ | true while the ball is alive and active. |
currentMove | EntityMoveType | ✅ | The movement action the ball is currently executing. |
currentGroundSide | Side | ✅ | The side the ball is resting on; nil when airborne. |
isOnAir | boolean | ✅ | true when the ball is not touching the ground. |
jumpMode | BallJumpMode | ✅ | Current jump capability: Banned (0), Normal (1), or Bouncing (2). |
slowMode | boolean | ❌ | Read or write to enable/disable slow-motion movement. |
mirrorMode | boolean | ❌ | Read or write to enable/disable mirrored controls. |
isBurning | boolean | ✅ | true when a burning effect is active. |
burningAmount | number | ✅ | Accumulated burning intensity on the ball. |
isIcy | boolean | ✅ | true when the ball has the icy status. |
hasShield | boolean | ✅ | true while a shield is protecting the ball. |
respawnSide | Side | ✅ | The side set as the ball’s current respawn point. |
respawnOrientation | Orientation | ✅ | The orientation at the current respawn point. |
properties | ElementPropertyPool | ✅ | Custom property pool attached to the ball. |
localData | RawLocalData | ✅ | Per-instance local data store for this ball. |
Methods
kill
Kills the ball after a delay. Three overloads are available:instaKill
Kills the ball immediately without a delay. Three overloads mirrorkill:
teleportToSide
true on success.
doMove
increaseJumpMode / decreaseJumpMode
jumpMode up or down through Banned → Normal → Bouncing.
increaseJumpAheadDistance / decreaseJumpAheadDistance
increaseJumpUpDistance / decreaseJumpUpDistance
changeGravity
true when the change succeeds.
enableShield / increaseShieldTime
seconds.
addBurningAmount
linkBall / unlinkBall / unlinkAllBalls
isBallLinked
true when this ball is linked to ball.
getLinkedBalls / getLinkedBallsIterator
getLinkedBalls returns a table; getLinkedBallsIterator returns an iterator-compatible form for use in for loops.
setRespawnLocation
Two overloads let you pin the respawn point to a side or to a specific block slot + face:collectItem
Type-cast helpers
Every entity exposes a set ofas* methods. Call them when you hold a generic entity reference and need to narrow its type. Each throws an error if the cast is invalid.
BallData
BallData is the raw, mutable representation of a ball used when building or modifying level data (e.g. in OnLevelLoad). It holds the initial spawn position, scripting fields, and design-time properties.
| Property | Type | Read-only | Description |
|---|---|---|---|
initialPosition | BlockLocation | ✅ | The block location where the ball spawns at level start. |
template | string | ❌ | Template identifier that determines the ball’s appearance and base behaviour. |
scriptRef | string | ❌ | Script file reference attached to this ball. |
scriptTag | string | ❌ | Tag forwarded to the ball’s script. |
scriptVars | ScriptVariables | ✅ | Variable table passed into the ball’s script. |
properties | ElementPropertiesData | ✅ | Design-time property data for the ball. |
clear() to reset a BallData instance to empty defaults.
Usage Example
The followingOnUpdate hook reads the ball’s position every frame and kills it instantly when it falls below y = –20: