1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-12-23 21:56:46 +00:00

make custom note style less clunky

This commit is contained in:
lemz 2024-05-31 23:56:57 +02:00 committed by EliteMasterEric
parent e3e4e9fac0
commit 3f39d9509c

View file

@ -1,5 +1,7 @@
package funkin.play.notes.notekind;
import funkin.data.notestyle.NoteStyleRegistry;
import funkin.play.notes.notestyle.NoteStyle;
import funkin.modding.IScriptedClass.INoteScriptedClass;
import funkin.modding.events.ScriptEvent;
@ -39,6 +41,23 @@ class NoteKind implements INoteScriptedClass
return noteKind;
}
/**
* Changes the note style of the given note. Use this in `onNoteIncoming`
* @param note
* @param noteStyle
*/
function setNoteStyle(note:NoteSprite, noteStyleId:String):Void
{
var noteStyle:NoteStyle = NoteStyleRegistry.instance.fetchEntry(noteStyleId);
noteStyle.buildNoteSprite(note);
note.setGraphicSize(Strumline.STRUMLINE_SIZE);
note.updateHitbox();
// this calls the setter for playing the correct animation
note.direction = note.direction;
}
/**
* Retrieve all notes of this kind
* @return Array<NoteSprite>