character sing overides and no anim notes

This commit is contained in:
Eviethecoder
2025-09-25 16:45:50 +08:00
committed by Hundrec
parent 2f865a5c7f
commit 618e093e1c
3 changed files with 63 additions and 8 deletions
+33 -7
View File
@@ -49,6 +49,11 @@ class BaseCharacter extends Bopper
*/
public var debug:Bool = false;
/**
* The current note kind.
*/
public var curNoteKind:NoteKind;
/**
* This character plays a given animation when hitting these specific combo numbers.
*/
@@ -513,21 +518,41 @@ class BaseCharacter extends Bopper
public override function onNoteHit(event:HitNoteScriptEvent)
{
super.onNoteHit(event);
// If another script cancelled the event, don't do anything.
if (event.eventCanceled) return;
curNoteKind = NoteKindManager.getNoteKind(event.note.noteData.kind);
if (event.note.noteData.getMustHitNote() && characterType == BF)
{
// If the note is from the same strumline, play the sing animation.
this.playSingAnimation(event.note.noteData.getDirection(), false);
holdTimer = 0;
if (curNoteKind != null)
{
if (!curNoteKind.noanim)
{
this.playSingAnimation(event.note.noteData.getDirection(), false, curNoteKind?.suffix);
holdTimer = 0;
}
}
else
{
this.playSingAnimation(event.note.noteData.getDirection(), false);
holdTimer = 0;
}
}
else if (!event.note.noteData.getMustHitNote() && characterType == DAD)
{
// If the note is from the same strumline, play the sing animation.
this.playSingAnimation(event.note.noteData.getDirection(), false);
holdTimer = 0;
if (curNoteKind != null)
{
if (!curNoteKind.noanim)
{
this.playSingAnimation(event.note.noteData.getDirection(), false, curNoteKind?.suffix);
holdTimer = 0;
}
}
else
{
this.playSingAnimation(event.note.noteData.getDirection(), false);
holdTimer = 0;
}
}
else if (characterType == GF && event.note.noteData.getMustHitNote())
{
@@ -661,6 +686,7 @@ class BaseCharacter extends Bopper
// restart even if already playing, because the character might sing the same note twice.
// trace('Playing ${anim}...');
playAnimation(anim, true);
}
+13 -1
View File
@@ -23,6 +23,16 @@ class NoteKind implements INoteScriptedClass
*/
public var noteStyleId:Null<String>;
/**
* Whether or not the sing animation should play.
*/
public var noanim:Bool;
/**
* The animation suffix to use.
*/
public var suffix:String;
/**
* Custom parameters for the chart editor
*/
@@ -35,12 +45,14 @@ class NoteKind implements INoteScriptedClass
*/
public var scoreable:Bool = true;
public function new(noteKind:String, description:String = "", ?noteStyleId:String, ?params:Array<NoteKindParam>)
public function new(noteKind:String, description:String = "", ?noteStyleId:String, ?params:Array<NoteKindParam>, ?anim:Bool, ?suffix:String)
{
this.noteKind = noteKind;
this.description = description;
this.noteStyleId = noteStyleId;
this.params = params ?? [];
this.noanim = anim ?? false;
this.suffix = suffix ?? '';
}
public function toString():String
@@ -129,6 +129,23 @@ class NoteKindManager
return noteStyleId;
}
/**
* Retrieve custom params of the given note kind
* @param noteKind Name of the note kind
* @return Array<NoteKindParam>
*/
public static function getNoteKind(noteKind:Null<String>):Null<NoteKind>
{
if (noteKind == null)
{
return null;
}
else
{
return noteKinds.get(noteKind);
}
}
/**
* Retrive custom params of the given note kind
* @param noteKind Name of the note kind