Skip to main content

Overview

The song event system allows chart creators to trigger gameplay changes at specific points in a song. Events can control camera focus, zoom, character swaps, stage changes, and more.

Class Hierarchy

SongEvent

Base class for all song events.

Properties

String
Unique identifier for this event type
Bool
default:"false"
If true, events are handled even when skipping forward in the song

Methods

new(id:String, ?params:SongEventParams)

Creates a new event handler.
String
required
Event type identifier
SongEventParams
Optional parameters (processOldEvents)

handleEvent(data:SongEventData):Void

Handles the event when it’s triggered. Must be overridden.

getEventSchema():SongEventSchema

Returns the chart editor schema for this event.

getTitle():String

Returns the human-readable title.

getIconPath():String

Returns the path to the event’s icon.

Built-in Events

FocusCameraSongEvent

Changes camera focus to a character or position.

Event Data

Int
default:"0"
Target: -1 (Position), 0 (Player/BF), 1 (Opponent/Dad), 2 (Girlfriend)
Float
default:"0"
X offset or absolute X position
Float
default:"0"
Y offset or absolute Y position
Float
default:"4.0"
Tween duration in steps
String
default:"CLASSIC"
Easing function: linear, INSTANT, CLASSIC, sine, quad, cube, etc.
String
default:"In"
Easing direction: In, Out, InOut

Examples


ZoomCameraSongEvent

Changes camera zoom level.

Event Data

Float
default:"1.0"
Target zoom level
Float
default:"4.0"
Tween duration in steps
String
default:"direct"
“stage” (relative to stage zoom) or “direct” (absolute)
String
default:"linear"
Easing function
String
default:"In"
Easing direction

Examples


Other Built-in Events

SetCharacterSongEvent
  • Swaps a character mid-song
  • Useful for character transformations
SetStageSongEvent
  • Changes the entire stage
  • Can trigger scene transitions
PlayAnimationSongEvent
  • Forces a character to play a specific animation
  • Useful for cutscenes
ScrollSpeedEvent
  • Changes scroll speed mid-song
  • Can speed up or slow down gameplay
SetCameraBopSongEvent
  • Controls camera bop intensity
  • Affects camera “bounce” on beats
SetHealthIconSongEvent
  • Changes a character’s health icon
  • Useful for character transformations

Creating Custom Events

Basic Custom Event

Advanced Custom Event

Event Data Access

Reading Event Values

Event Schema Types

Field Types

Schema Example

Easing Functions

Available easing functions from FlxEase:
  • linear
  • sine, quad, cube, quart, quint
  • expo, circ, back, bounce, elastic
  • smoothStep, smootherStep
Easing directions:
  • In - Slow start, fast end
  • Out - Fast start, slow end
  • InOut - Slow start and end

Usage in Charts

Chart JSON Format

Float
required
Event timestamp in milliseconds
String
required
Event type ID
Dynamic
required
Event-specific values/parameters

Best Practices

Use processOldEvents: true for events that should always execute, like camera position changes. Use false (default) for momentary effects like flashes.
Always check if PlayState.instance exists before accessing it in event handlers. Events can be processed in the chart editor.
Event schemas are used by the chart editor to provide a user-friendly interface. Well-defined schemas make events easier to use.