Skip to main content

PlayStateNoteHelpers

Kindclass
Packageplay.helpers
Full nameplay.helpers.PlayStateNoteHelpers
Sourcesource/play/helpers/PlayStateNoteHelpers.hx
Metadata@:access(play.PlayState) @:access(backend.MusicBeatState)

Public methods​

sortNoteGroup​

static function sortNoteGroup(group:FlxTypedGroup<Note>):Void

Sorts one note group by y for the current scroll direction, reusing the cached comparator instead of allocating a closure like FlxTypedGroup.sort() does.

@param group PlayState.notes or PlayState.sustainNotes.

ParameterTypeDefault
groupFlxTypedGroup<Note>—

View source

addBehindGF​

static function addBehindGF(state:PlayState, obj:FlxObject)
ParameterTypeDefault
statePlayState—
objFlxObject—

View source

addBehindBF​

static function addBehindBF(state:PlayState, obj:FlxObject)
ParameterTypeDefault
statePlayState—
objFlxObject—

View source

addBehindDad​

static function addBehindDad(state:PlayState, obj:FlxObject)
ParameterTypeDefault
statePlayState—
objFlxObject—

View source

clearNotesBefore​

static function clearNotesBefore(state:PlayState, time:Float)
ParameterTypeDefault
statePlayState—
timeFloat—

View source

KillNotes​

static function KillNotes(state:PlayState)
ParameterTypeDefault
statePlayState—

View source

invalidateNote​

static function invalidateNote(state:PlayState, note:Note):Void

Queues a note for recycling at the end of the frame.

The killNotes array used to be scanned with contains() on every call, which is O(live notes) per note per frame; the queue membership now lives on the note itself. (#88)

ParameterTypeDefault
statePlayState—
noteNote—

View source

destroyNotes​

static function destroyNotes(state:PlayState):Void

Kills every queued note and empties the queue in place.

Runs once per frame, so it must not allocate: the previous killNotes = [] threw away a fresh array every frame and iterator() added another object on top. Killed notes stay group members with exists == false, which is exactly what FlxTypedGroup.recycle() picks up next time a note spawns.

ParameterTypeDefault
statePlayState—

View source

spawnHoldSplashOnNote​

static function spawnHoldSplashOnNote(state:PlayState, note:Note, isDad:Bool = false)
ParameterTypeDefault
statePlayState—
noteNote—
isDad (optional)Boolfalse

View source

spawnHoldSplash​

static function spawnHoldSplash(state:PlayState, note:Note)
ParameterTypeDefault
statePlayState—
noteNote—

View source

spawnNoteSplashOnNote​

static function spawnNoteSplashOnNote(state:PlayState, isDad:Bool, note:Note)
ParameterTypeDefault
statePlayState—
isDadBool—
noteNote—

View source

spawnNoteSplash​

static function spawnNoteSplash(state:PlayState, x:Float, y:Float, data:Int, note:Note = null)
ParameterTypeDefault
statePlayState—
xFloat—
yFloat—
dataInt—
note (optional)Notenull

View source

spawnCrossFade​

static function spawnCrossFade(group:FlxTypedGroup<CrossFade>, character:Character, isDad:Bool = true):Void

Spawns a cross fade ghost out of its pool.

Replaces the old new CrossFade(...) call sites, which allocated a sprite, a frames copy, an animation and a tween callback on every opponent note hit that carried the effect. (#88)

@param group one of PlayState.grpCrossFade / grpGFCrossFade / grpBFCrossFade. @param character the character to ghost. @param isDad true on the opponent side of the strum line.

ParameterTypeDefault
groupFlxTypedGroup<CrossFade>—
characterCharacter—
isDad (optional)Booltrue

View source

generateStaticArrows​

static function generateStaticArrows(state:PlayState, player:Int):Void
ParameterTypeDefault
statePlayState—
playerInt—

View source

Internals​

Private / internal members
FieldTypeStatic
notesAscendingNote->Note->Int = compareNoteY.bind(FlxSort.ASCENDING)yes
notesDescendingNote->Note->Int = compareNoteY.bind(FlxSort.DESCENDING)yes
Method
static function compareNoteY(order:Int, note1:Note, note2:Note):Int
static function clearGroupNotesBefore(group:FlxTypedGroup<Note>, time:Float)
static function killNoteGroup(group:FlxTypedGroup<Note>)