Overview
The notes system handles note rendering, hit detection, and strumline management. TheStrumline 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
Whether this strumline is controlled by player input (true) or CPU (false)
Scroll speed multiplier for notes
Whether notes scroll downward instead of upward
Active notes heading toward the strumline
Active hold/sustain notes
The receptor arrows (4 directions)
Note data from the chart
Whether to show note splash effects on sick hits
Methods
new(noteStyle:NoteStyle, isPlayer:Bool, ?scrollSpeed:Float)
Creates a new strumline.
Note style for visuals (e.g., “funkin”, “pixel”)
True for player-controlled, false for CPU
Initial scroll speed multiplier
applyNoteData(data:Array<SongNoteData>):Void
Loads note data from a chart.
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.
The note that was hit
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
Time when the note should be hit (milliseconds)
Hold note length in milliseconds (0 for single notes)
Direction of the note (LEFT, DOWN, UP, RIGHT)
Note kind (e.g., “alt”, “hurt”) for special behavior
Reference to the chart data for this note
True if the note has been hit
True if the note was missed
True if the note is within the hit window
True if the note is before the hit window
Whether this note contributes to score/accuracy
True if this is a hold note (length > 0)
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 byConstants.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 millisecondsfullSustainLength: Original total lengthhitNote: Whether the note head was hitmissedNote: Whether the hold was droppedcover: Visual cover that appears when holding
Behavior
- Note head must be hit first
- Hold note clips as it’s held
- Dropped if key is released early
- Completed when sustainLength reaches 0
Usage Examples
Creating a Strumline
Handling Input
Custom Note Behavior
Best Practices
The strumline automatically recycles note sprites for performance. Don’t destroy notes manually unless absolutely necessary.
