Hardcoded scripts (wip)#1033
Conversation
|
I'm quite curious, what would be the main use case of this? I can see this having some potential, but I'm somewhat concerned how this will work for different platforms. |
|
It's mainly meant for large mods with lots of big scripts, where hscript just isn't fast enough to handle it. A basic script looks something like this: @:registerScript("songs/bopeebo/scripts/script.hx")
class Script extends HardcodedScript<PlayState> {
var a:Int = 0;
@:publicVar var testPublic:Float = 50.0; //@:publicVar generates a get/set func to directly access the publicVariables map
@:publicVarRef var testPublicFromAnotherScript:Float; //same as @:publicVar but doesn't init the variable, mainly for helping the compiler know which type it is
public function create() {
trace("script loaded");
}
override public function update(elapsed:Float) {
parent.dad.angle += testPublic*elapsed;
}
function onNoteHit(event:NoteHitEvent) {
trace("note hit");
}
} |
No description provided.