mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2025-03-22 01:49:21 +00:00
helper function
This commit is contained in:
parent
c83e505f5b
commit
e3e4e9fac0
|
@ -18,6 +18,16 @@ class NoteKind implements INoteScriptedClass
|
|||
*/
|
||||
public var description:String = "";
|
||||
|
||||
/**
|
||||
* this only exists for people that don't like calling functions
|
||||
*/
|
||||
var notes(get, never):Array<NoteSprite>;
|
||||
|
||||
function get_notes():Array<NoteSprite>
|
||||
{
|
||||
return this.getNotes();
|
||||
}
|
||||
|
||||
public function new(noteKind:String, description:String = "")
|
||||
{
|
||||
this.noteKind = noteKind;
|
||||
|
@ -29,6 +39,18 @@ class NoteKind implements INoteScriptedClass
|
|||
return noteKind;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve all notes of this kind
|
||||
* @return Array<NoteSprite>
|
||||
*/
|
||||
function getNotes():Array<NoteSprite>
|
||||
{
|
||||
var allNotes:Array<NoteSprite> = PlayState.instance.playerStrumline.notes.members.concat(PlayState.instance.opponentStrumline.notes.members);
|
||||
return allNotes.filter(function(note:NoteSprite) {
|
||||
return note != null && note.noteData.kind == this.noteKind;
|
||||
});
|
||||
}
|
||||
|
||||
public function onScriptEvent(event:ScriptEvent):Void {}
|
||||
|
||||
public function onCreate(event:ScriptEvent):Void {}
|
||||
|
|
Loading…
Reference in a new issue