Enemy class represents a hostile entity that roams the game world and can harm or interact with the ball. Scripts attached to an enemy receive it as self in hooks such as OnDeath and OnUpdate. Through the Enemy API you can read its position and orientation, toggle whether it responds to specific level hazards (via EnemyInteraction flags), and kill or disable it programmatically.
Properties
Identity
Transform
Data
Methods
enable / disable
kill
enableInteraction / disableInteraction
EnemyInteraction type.
setInteractionEnabled
enableInteraction/disableInteraction.
isInteractionEnabled
true when the given interaction is currently active for this enemy.
Type-cast helpers
Use these to narrow a generic entity reference to a concrete type. Each throws an error if the cast is invalid.EnemyInteraction Enum
TheEnemyInteraction enum controls which level hazards and mechanics the enemy reacts to. Use it with the interaction methods above.
EnemyData
EnemyData is the mutable data representation used when building or modifying level data (e.g. in OnLevelLoad). It exposes template, scriptRef, scriptTag, scriptVars, properties, the read-only initialPosition (BlockLocation), and an interactions array (EnemyInteraction[]). The same four interaction helper methods — enableInteraction, disableInteraction, setInteractionEnabled, isInteractionEnabled — are available on EnemyData for use at design time. Call clear() to reset all fields.
Usage Example
TheOnDeath hook fires when an enemy is killed. The example below checks whether the ball that killed the enemy has a shield, then disables all spike interactions on a second enemy: