class Strumline
package funkin.play.notes
extends FlxTypedSpriteGroup › FlxSprite › FlxObject › FlxBasic
extended by ScriptedStrumline
Available on all platforms
A group of sprites which handles the receptor, the note splashes, and the notes (with sustains) for a given player.
Static variables
staticfinalread onlyDIRECTIONS:Array<NoteDirection> = [NoteDirection.LEFT, NoteDirection.DOWN, NoteDirection.UP, NoteDirection.RIGHT]
The directions of the notes on the strumline, in order.
staticfinalread onlyNOTE_SPACING:Int = STRUMLINE_SIZE + 8
The spacing between notes on the strumline, in pixels.
staticfinalread onlySTRUMLINE_SIZE:Int = 104
A magic number for the size of the strumline, in pixels.
Constructor
Variables
conductorInUse:Conductor
Usually you want to keep this as is, but if you are using a Strumline and playing a sound that has it's own conductor, set this (LatencyState for example)
customRenderDistanceMs:Float = 0.0
The custom render distance for the strumline. This should be in miliseconds only! Not pixels.
holdNotes:FlxTypedSpriteGroup<SustainTrail>
The hold notes currently being rendered on the strumline. This group iterates over this every frame to update hold note positions. The PlayState also iterates over this to calculate user inputs.
isPlayer:Bool
Whether this strumline is controlled by the player's inputs. False means it's controlled by the opponent or Bot Play.
nextNoteIndex:Int = -1
The index of the next note to be rendered. This is used to avoid splicing the noteData array, which is slow. It is incremented every time a note is rendered.
noteData:Array<SongNoteData> = []
The note data for the song. Should NOT be altered after the song starts (but we alter it in OffsetState :DDD), so we can easily rewind.
noteVibrations:NoteVibrationsHandler = new NoteVibrationsHandler()
Handles note vibrations for this strumline
notes:FlxTypedSpriteGroup<NoteSprite>
The notes currently being rendered on the strumline. This group iterates over this every frame to update note positions. The PlayState also iterates over this to calculate user inputs.
onNoteIncoming:FlxTypedSignal<NoteSprite ‑> Void>
A signal that is dispatched when a note is spawned and heading towards the strumline.
showNotesplash:Bool = true
Whether to play note splashes or not TODO: Make this a setting! IE: Settings.noSplash
read onlystrumlineScale:FlxPoint
The scale of the strumline. Use this to resize it rather than setting the scale directly.
useCustomRenderDistance:Bool = false
Whether to use the custom render distance. If false, the render distance will be calculated based on the screen height.
Methods
addNoteData(note:SongNoteData, sort:Bool = true):Void
Add a note data to the strumline.
This will not remove existing notes, so you should call applyNoteData if you want to reset the strumline.
Parameters:
note | The note data to add. |
|---|---|
sort | Whether to sort the note data after adding. |
applyNoteData(data:Array<SongNoteData>):Void
Apply note data from a chart to this strumline. Note data should be valid and apply only to this strumline.
Parameters:
data | The note data to apply. |
|---|
buildHoldNoteSprite(note:SongNoteData):SustainTrail
Build a hold note sprite for a given note data.
Parameters:
note | The note data to build the hold note sprite for. |
|---|
Returns:
The hold note sprite. Will recycle a hold note sprite from the pool if available for performance.
buildNoteSprite(note:SongNoteData):NoteSprite
Build a note sprite for a given note data.
Parameters:
note | The note data to build the note sprite for. |
|---|
Returns:
The note sprite. Will recycle a note sprite from the pool if available for performance.
clean():Void
Called when the song is reset. Removes any special animations and the like. Doesn't reset the notes from the chart, that's handled by the PlayState.
enterMiniMode(scale:Float = 1):Void
Enter mini mode, which displays only small strumline notes
Parameters:
scale | scale of strumline |
|---|
fadeInArrows():Void
Play a fade in animation on all arrows in the strumline. Used when starting a song in Freeplay mode.
fadeOutArrow(index:Int, arrow:StrumlineNote):Void
Apply a small animation which moves the arrow up and fades it out. Used when the song ends in Freeplay mode.
Parameters:
index | The index of the arrow in the strumline. |
|---|---|
arrow | The arrow to animate. |
fadeOutArrows():Void
Play a fade out animation on all arrows in the strumline. Used when ending a song in Freeplay mode.
getByDirection(direction:NoteDirection):StrumlineNote
Get a strumline note sprite by its direction.
Parameters:
direction | The direction of the note to get. |
|---|
Returns:
The note.
getByIndex(index:Int):StrumlineNote
Get a strumline note sprite by its index.
Parameters:
index | The index of the note to get. |
|---|
Returns:
The note.
getHoldNoteSprite(target:SongNoteData):SustainTrail
Get a hold note sprite corresponding to the given note data.
Parameters:
target | The note data for the hold note. |
|---|
Returns:
The hold note sprite.
getHoldNotesHitOrMissed():Array<SustainTrail>
Return hold notes that are within Constants.HIT_WINDOW ms of the strumline.
Returns:
An array of SustainTrail objects.
getNoteSprite(target:SongNoteData):NoteSprite
Get a note sprite corresponding to the given note data.
Parameters:
target | The note data for the note sprite. |
|---|
Returns:
The note sprite.
getNotesMayHit():Array<NoteSprite>
Return notes that are within Constants.HIT_WINDOW ms of the strumline.
Returns:
An array of NoteSprite objects.
getNotesOnScreen():Array<NoteSprite>
Return notes that are within, or way after, Constants.HIT_WINDOW ms of the strumline.
Returns:
An array of NoteSprite objects.
handleSkippedNotes():Void
Called when the PlayState skips a large amount of time forward or backward.
hitNote(note:NoteSprite, removeNote:Bool = true):Void
Hit a note.
Parameters:
note | The note to hit. |
|---|---|
removeNote | True to remove the note immediately, false to make it transparent and let it move offscreen. |
holdConfirm(direction:NoteDirection):Void
Play a confirm animation for a hold note.
Parameters:
direction | The direction of the note to play the confirm animation for. |
|---|
isConfirm(direction:NoteDirection):Bool
Check if a given direction is playing the confirm animation.
Parameters:
direction | The direction of the note to check. |
|---|
Returns:
true if the note is playing the confirm animation, false otherwise.
isKeyHeld(dir:NoteDirection):Bool
Check if a key is held down.
Parameters:
dir | The direction of the key to check. |
|---|
Returns:
true if the key is held down, false otherwise.
killNote(note:NoteSprite):Void
Kill a note heading towards the strumline.
Parameters:
note | The note to kill. Gets recycled and reused for performance. |
|---|
playConfirm(direction:NoteDirection):Void
Play a confirm animation for a given direction.
Parameters:
direction | The direction of the note to play the confirm animation for. |
|---|
playNoteHoldCover(holdNote:SustainTrail):Void
Play a note hold cover for a given hold note.
Parameters:
holdNote | The hold note to play the cover animation for. |
|---|
playNoteSplash(direction:NoteDirection):Void
Play a note splash for a given direction.
Parameters:
direction | The direction of the note to play the splash animation for. |
|---|
playPress(direction:NoteDirection):Void
Play a press animation for a given direction.
Parameters:
direction | The direction of the note to play the press animation for. |
|---|
playStatic(direction:NoteDirection):Void
Play a static animation for a given direction.
Parameters:
direction | The direction of the note to play the static animation for. |
|---|
pressKey(dir:NoteDirection, keyCode:Int):Void
Called when a key is pressed.
Parameters:
dir | The direction of the key that was pressed. |
|---|---|
keyCode | The key input used to press the direction. Used to distinguish when two keys for the same direction are pressed. |
releaseKey(dir:NoteDirection, ?keyCode:Int):Void
Called when a key is released.
Parameters:
dir | The direction of the key that was released. |
|---|---|
keyCode | The key input used to press the direction. Used to distinguish when two keys for the same direction are pressed. If null, all keys for the direction are released. |
resetScrollSpeed(?newScrollSpeed:Float):Void
Reset the scroll speed to the current chart's scroll speed.
setNoteSpacing(multiplier:Float = 1):Void
Set note spacing scale
Parameters:
multiplier | multiply x position |
|---|
vwooshInNotes():Void
For a note's strumTime, calculate its Y position relative to the strumline. NOTE: Assumes Conductor and PlayState are both initialized.
Parameters:
strumTime |
|---|
Returns:
Float Reverse of vwooshNotes, we bring the notes IN (by their offsets)