Skip to main content
Projectiles are objects that travel through the level and explode when they hit something. You create them with Level.createProjectile, configure their speed, direction, homing behavior, and explosion rules, then fire them — either automatically at creation or manually in your own code. Every projectile can carry onFire, onExplode, and onUpdate callbacks so you have frame-by-frame control over its behavior.

Creating a Projectile

The simplest signature creates a projectile in the main section using an inline property table:
You can also pass a ProjectileRequest object instead of a table.

Full Property Table

All fields except skin, origin, and rotation are optional.

Using ProjectileRequest

ProjectileRequest is a class alternative to the inline table. It is useful when you want to build the configuration incrementally or reuse a base configuration across multiple enemies.
Set properties directly on the object:

Querying Available Skins

Before you create a projectile, make sure the skin you want actually exists in the level:

The Projectile Object

Level.createProjectile returns a Projectile. You can read and write its properties after creation, and call methods to fire or detonate it manually.

Key Properties

Fire and Explode


The OnProjectileCollide Hook

Any entity script (Ball, Block, Enemy, Item, Side) can define OnProjectileCollide to react when a projectile hits it:
OnProjectileCollide fires before the projectile explodes. The projectile is still active inside this callback.

Complete Example — Enemy That Fires a Homing Projectile

This script is attached to an Enemy entity. It fires a homing shot at the ball every 4 seconds using a cooldown tracked via elapsed time. When the projectile hits the ball, the player loses a life.
Always check ball.isAlive before reading ball.position inside OnUpdate. The ball reference from Level.currentBall can briefly be inactive between levels or after a death sequence.
Use Vector3 and Quaternion for all position and rotation math. See the Vector3 reference and Quaternion reference pages for a full list of helpers like Vector3.distance, Vector3.normalized, and Quaternion.lookRotation.