Phaser AE

Actor movement chips

Free packv3.0.0-22DArcade

The movement behaviours arcade enemies are made of: seek, flee, orbit, home in, patrol, wander and more. Each chip is one step of one behaviour on any object with a position and a velocity, so they mix freely and fit whatever your game already uses for its things.

This is a Free pack. Every phaser.io account can use it in their games.

Released October 14, 2026 · updated October 19, 2026

Actor movement chips: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

The pack

actors

function actors(): Pack<{ actors: ActorsApi }>

The actors pack. Pure logic, so it needs no backend and runs headless.

Helpers

chips

const chips: { drift(a: Mover & { spin?: number; }, dt: number, o?: IntegrateOptions): void; seek(a: Mover, to: XY, o: SeekOptions, dt: number): void; ... 12 more ...; wander(a: Mover, speed: number, turn: number, rng: () => number, dt: number): void; } …

The chips. Each is one frame of one behaviour, mutating the mover — compose them by calling more than one, and none of them owns the actor.

createTimer

function createTimer(period: number, o: { repeat?: boolean; start?: boolean; ready?: boolean } = {}): Timer

Creates a Timer.

faceVelocity

function faceVelocity(a: Mover): void

Point a mover along its own velocity — the drifting rock, the free-flying shot.

hyperspace

function hyperspace(a: Mover, area: { x?: number; y?: number; w: number; h: number }, rng: () => number, o: { danger?: number; clear?: number; avoid?: readonly XY[]; tries?: number } = {}, ): HyperspaceResult

Jump somewhere random. danger is the chance it goes wrong, and clear keeps a successful jump away from the things listed — a hyperspace that can drop you on a rock is a coin flip, not a decision.

integrate

function integrate(a: Mover, dt: number, o: IntegrateOptions = {}): void

One step of plain motion. drag is per SECOND, not per frame, so the feel does not change with the frame rate — the mistake vx *= 0.98 makes.

speedOf

function speedOf(a: Mover): number

Current speed.

splitInto

function splitInto(parent: Mover, o: { count?: number; /** Outward speed added to the inherited velocity. */ speed?: number; /** Total fan, radians. Default a full circle. */ spread?: number; /** Fraction of the parent's velocity kept. Default 1. */ inherit?: number; /** Spread the fan about this heading. Default the parent's own. */ angle?: number; rng?: () => number; } = {}): Mover[]

The split: children at the parent's position, sharing its momentum plus an even outward fan. Inheriting the parent's velocity is what makes an Asteroids split read as one rock breaking rather than two rocks appearing.

Classes

Timer

class Timer

A countdown that reports the frame it fires on. Minelayers, hatching grubs, regenerating shields, reload gates — all the same object.

  • period: number — The length of the countdown, in seconds.
  • left: number — Seconds left in the current countdown.
  • repeat: boolean — True for a timer that re-arms itself after each period.
  • running: boolean — Off until start().
  • constructor(period: number, o: { repeat?: boolean; start?: boolean; ready?: boolean } = {})
  • update(dt: number): boolean — True on the frame it reaches zero. A repeating timer re-arms itself.
  • get ready(): boolean — Non-destructive readiness: a period has completed and nothing has spent it. Ask as many times a frame as you like — it never advances the clock and never consumes the event, which is exactly what update(dt) cannot promise. True on repeating AND one-shot timers alike.
  • use(): boolean — Ask-AND-consume — the gate a fire button wants. True at most once per completed period, re-arming as it returns, so the cooldown lives in here rather than in the caller: if (fire.held && reload.use()) shoot(); Works the same whether the timer repeats or not.
  • get frac(): number — 0..1 through the period — a reload bar, a hatch warning.
  • get done(): boolean — True when a one-shot timer has fired and stopped.
  • reset(period = this.period): this — Restarts the countdown, with a new period when one is given. Returns this.
  • stop(): this — Stops the countdown. Returns this.

Types

ActorsApi

type ActorsApi = typeof kit

game.actors — every function and type this pack carries, as one namespace.

AvoidAimOptions

interface AvoidAimOptions extends SeekOptions

Configures the avoidAim chip.

  • arc?: number — Half-angle of the player's "aimed at me" cone, radians. Default 0.5.
  • retreat?: number — Acceleration away while aimed at. Default accel.

HomeOptions

interface HomeOptions

Configures the home chip.

  • speed: number — Constant flight speed.
  • turn: number — Radians per second it can turn. A missile that can turn instantly is not a missile.

HyperspaceResult

interface HyperspaceResult extends XY

The result of hyperspace: the landing point, and whether the jump was safe.

  • ok: boolean — False when the jump failed — the classic risk of the verb.

IntegrateOptions

interface IntegrateOptions

Configures integrate, and the chips that call it.

  • drag?: number — Fraction of velocity shed per second, 0..1. Default 0.
  • gravity?: number — Downward acceleration (screen +y). Default 0.
  • maxSpeed?: number — Speed ceiling. Default Infinity.

Mover

interface Mover extends XY

The minimum a chip needs. rot is optional and in screen-clockwise radians.

  • vx: number — Velocity on x, in units each second.
  • vy: number — Velocity on y, in units each second.
  • rot?: number — The facing angle, in screen-clockwise radians.

OrbitOptions

interface OrbitOptions

Configures the orbit chip.

  • radius: number — The distance from the centre to circle at.
  • rate: number — Radians per second, + is clockwise on screen.
  • pull?: number — How hard it is pulled back onto the radius. Default 2.

SeekOptions

interface SeekOptions extends IntegrateOptions

Configures the seek, flee and evade chips.

  • accel: number — Acceleration toward the target, units/s².
  • standoff?: number — Stop accelerating inside this. Default 0.

XY

interface XY

A 2D point: the x and y position.

  • x: number — The x position.
  • y: number — The y position.