Skip to main content

Overview

The notes system handles note rendering, hit detection, and strumline management. The Strumline class manages receptors, notes, and sustains for a single player, while NoteSprite represents individual notes.

Class Hierarchy

Strumline

A group of sprites that handles receptors, notes, and note splashes for a given player.

Constants

Properties

Bool
Whether this strumline is controlled by player input (true) or CPU (false)
Float
default:"1.0"
Scroll speed multiplier for notes
Bool
Whether notes scroll downward instead of upward
FlxTypedSpriteGroup<NoteSprite>
Active notes heading toward the strumline
FlxTypedSpriteGroup<SustainTrail>
Active hold/sustain notes
FlxTypedSpriteGroup<StrumlineNote>
The receptor arrows (4 directions)
Array<SongNoteData>
Note data from the chart
Bool
default:"true"
Whether to show note splash effects on sick hits

Methods

new(noteStyle:NoteStyle, isPlayer:Bool, ?scrollSpeed:Float)

Creates a new strumline.
NoteStyle
required
Note style for visuals (e.g., “funkin”, “pixel”)
Bool
required
True for player-controlled, false for CPU
Float
Initial scroll speed multiplier

applyNoteData(data:Array<SongNoteData>):Void

Loads note data from a chart.
Array<SongNoteData>
required
Array of note data from the chart

addNoteData(note:SongNoteData, sort:Bool = true):Void

Adds a single note to the strumline.

pressKey(dir:NoteDirection, keyCode:Int):Void

Registers a key press.

releaseKey(dir:NoteDirection, ?keyCode:Int):Void

Registers a key release.

isKeyHeld(dir:NoteDirection):Bool

Checks if a direction is being held.

hitNote(note:NoteSprite, removeNote:Bool = true):Void

Marks a note as hit.
NoteSprite
required
The note that was hit
Bool
default:"true"
If true, removes note immediately. If false, makes it transparent.

killNote(note:NoteSprite):Void

Kills a note (for misses or cleanup).

playConfirm(direction:NoteDirection):Void

Plays the confirm animation on a receptor.

playPress(direction:NoteDirection):Void

Plays the press animation on a receptor.

playStatic(direction:NoteDirection):Void

Returns a receptor to its static/idle state.

playNoteSplash(direction:NoteDirection):Void

Plays a note splash effect.

getNotesMayHit():Array<NoteSprite>

Returns notes within the hit window.

clean():Void

Resets the strumline, removing all notes and resetting state.

vwooshNotes():Void

Animates all notes flying off-screen (for restarts).

vwooshInNotes():Void

Animates notes flying in from off-screen.

resetScrollSpeed(?newScrollSpeed:Float):Void

Resets scroll speed to chart default or specified value.

NoteSprite

Represents a single note heading toward the strumline.

Properties

Float
Time when the note should be hit (milliseconds)
Float
default:"0.0"
Hold note length in milliseconds (0 for single notes)
NoteDirection
Direction of the note (LEFT, DOWN, UP, RIGHT)
Null<String>
Note kind (e.g., “alt”, “hurt”) for special behavior
SongNoteData
Reference to the chart data for this note
Bool
default:"false"
True if the note has been hit
Bool
default:"false"
True if the note was missed
Bool
default:"false"
True if the note is within the hit window
Bool
default:"false"
True if the note is before the hit window
Bool
default:"true"
Whether this note contributes to score/accuracy
Bool
True if this is a hold note (length > 0)
SustainTrail
Reference to the hold note sprite

Methods

new(noteStyle:NoteStyle, direction:Int = 0)

Creates a new note sprite.

setupNoteGraphic(noteStyle:NoteStyle):Void

Sets up the note’s visual appearance.

getParam(name:String):Null<Dynamic>

Retrieves a custom parameter value.

desaturate():Void

Desaturates the note (used after hitting).

setHue(hue:Float):Void

Changes the note’s hue.

Hit Detection

Hit Window

Notes can be hit within a time window defined by Constants.HIT_WINDOW_MS:

Judgement Timing

Typical timing windows:
  • Sick: ±45ms
  • Good: ±90ms
  • Bad: ±135ms
  • Shit: ±166ms

Hold Notes (SustainTrail)

Hold notes are rendered as trails that follow regular notes:

Properties

  • sustainLength: Remaining length in milliseconds
  • fullSustainLength: Original total length
  • hitNote: Whether the note head was hit
  • missedNote: Whether the hold was dropped
  • cover: Visual cover that appears when holding

Behavior

  1. Note head must be hit first
  2. Hold note clips as it’s held
  3. Dropped if key is released early
  4. Completed when sustainLength reaches 0

Usage Examples

Creating a Strumline

Handling Input

Custom Note Behavior

Best Practices

Always check note.mayHit before allowing hits. Notes outside the hit window should not be hittable.
Use getNotesMayHit() to get only notes that can currently be hit, avoiding unnecessary iteration.
The strumline automatically recycles note sprites for performance. Don’t destroy notes manually unless absolutely necessary.