Custom NoteKind #4042
Replies: 2 comments 2 replies
-
Example pulled from #2635: import funkin.play.notes.notekind.NoteKind;
class Mine extends NoteKind {
function new() {
var name:String = 'mine';
var title:String = 'Mine';
var noteStyleId:String = 'pixel';
var params = [
{
name: 'mineDamage',
title: 'Dealt Damage',
type: 'float',
min: 0.0,
max: 2.0,
step: 0.1,
precision: 1,
defaultValue: 2.0
}
];
super(name, title, noteStyleId, params);
}
override function onNoteMiss(event:NoteScriptEvent) {
event.healthChange = -event.note.getParam('mineDamage');
}
override function onUpdate(event:UpdateScriptEvent) {
for (note in this.getNotes()) {
note.hsvShader.hue += event.elapsed;
}
}
} |
Beta Was this translation helpful? Give feedback.
-
It's way better and easier to use scripts to achieve this. use my no animation note kind here as an example how to setup the script class: https://github.com/FunkinCrew/funkin.assets/pull/140/files You can use 2hot's song script as an example of how to do it all by script rather than code as well, it's just a matter of accessing PlayState.instance.health and subtracting the amount you wish to deal to the player when this note is hit. It starts as a float of 1 and can go to 2, so a subtraction of 0.5 will deal about one quarter of the player's health, if they're at full health. Here, I'll even give you the code for it if you're having trouble:import funkin.play.PlayState;
class mineDamageNote extends ScriptedNoteKind {
function new() {
super("mineDamage" , "Hurt Note idk", "CustomNoteKindId");
}
override function onNoteHit(event:HitNoteScriptEvent):Void {
PlayState.instance.health -= 0.5; // This will remove 1/4 of the player's health if they're at the max of 2.
super.onNoteHit(event);
} Place this in a file named mineDamageNote.hxc into scripts/notekinds/ set Hopefully that helps! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to make a basic custom notekind with a unique note texture that drains your health when you hit it, just as a little test, but I am unsure how the Notekind works. I can't seem to figure out how to find it on the Notekind drop down in the chart editor, and when I try to use the custom part of the dropdown, I still get nothing.
Beta Was this translation helpful? Give feedback.
All reactions