You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: assets/content/cookbook/Advanced/06.ScriptEventCallbacks.md
+30-30Lines changed: 30 additions & 30 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,36 @@ This chapter will walk you through the process of using script event callbacks f
6
6
7
7
Several base classes use functions that get an event dispatched to them whenever something in the game happens, such as when getting created or destroyed. With your scripted class, you can override these callbacks to perform custom behavior when these would receive a dispatched event. Not every base class has every callback to their disposal.
8
8
9
+
## Overriding Script Event Callbacks
10
+
11
+
Even if most base classes have the script event callbacks as empty functions, others have behavior that is entirely dependant on them. As such, you can skip the behavior or call it under a condition depending on if and where you put your super function call. One such example is in the script file for Boyfriend (Christmas)[^bf-christmas]
12
+
13
+
```haxe
14
+
// ...
15
+
16
+
public override function onNoteHit(event:HitNoteScriptEvent)
While most cannot be cancelled, cancelling some events provides more leeway to the custom behavior. An example to this would be having pre-song cutscenes, as seen in the script file for the song Darnell[^darnell]
@@ -55,36 +85,6 @@ public override function onNoteMiss(event:NoteScriptEvent):Void
55
85
56
86
```
57
87
58
-
## Overriding Script Event Callbacks
59
-
60
-
Even if most base classes have the script event callbacks as empty functions, others have behavior that is entirely dependant on them. As such, you can skip the behavior or call it under a condition depending on if and where you put your super function call. One such example is in the script file for Boyfriend (Christmas)[^bf-christmas]
There is a predefined list of every script event callback the game has set up to be overridable, with their respective event type whose fields you can read from or write to. More of these will be added to the future.
0 commit comments