From d77b594c2230f911f6d6fc04a64cc103e5978067 Mon Sep 17 00:00:00 2001 From: entar Date: Mon, 11 Aug 2025 15:31:05 +0700 Subject: [PATCH] Update Scripting --- Scripting.md | 49 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/Scripting.md b/Scripting.md index 2eb8541..7430ca9 100644 --- a/Scripting.md +++ b/Scripting.md @@ -5,39 +5,38 @@ - `module.onUpdate(deltaTime, elapsed)` -- Calls before every frame render, here you usually update your sprites depending on the condition / song time. Delta stands for the last frame render time and elapsed stands for the current song time. - `module.onClose()` -- Gets called when the PlayState is exiting / Player dies. Here you remove all calculations / other stuff (Sprites are cleaned up automatically) - `module.onBeat(beat)` -- Gets called every beat. Obvious. +- `module.noteHit(note)` -- Gets called when the PLAYER hits a note (or a sustain fragment). +- `module.opponentNoteHit(note)` -- Gets called when the OPPONENT hits a note (or a sustain fragment). +- `module.processNote(note)` -- This function is called whenever a note is getting created. This is used for custom note stuff. +- `module.onPause()` -- Gets called when the player pauses the game. +- `module.onUnpause()` -- Gets called when the player unpauses the game. +- `module.onDeath()` -- Gets called when the player loses. +- `module.drawBelowUI()` -- This function is used to draw stuff below UI (love.graphics.draw etc.) (Draws on the GAME canvas.). +- `module.onDraw()` -- This function is used to draw stuff above UI (love.graphics.draw etc.) (Draws on the UI canvas.). +- `module.onEvent(event)` -- Gets called when a event gets ran. # Shared variables. ### Shared variables are accessible through module.shared ``` -module.shared.canStart = boolean -- Tells the game if it can start. Should only change at the onCreate() function and then resuming it through another function like onUpdate() check. -module.shared.screenSize = Vector2 -- Only usable in module.onCreate() -module.shared.canvasSize = Vector2 -- Only usable in module.onCreate() -module.shared.singVectors = { - singLEFT = myTypes.Vector2(20, 0), - singDOWN = myTypes.Vector2(0, -20), - singUP = myTypes.Vector2(0, 20), - singRIGHT = myTypes.Vector2(-20, 0), - ["singLEFT-alt"] = myTypes.Vector2(20, 0), -- alt anims need to be here too - ["singDOWN-alt"] = myTypes.Vector2(0, -20), - ["singUP-alt"] = myTypes.Vector2(0, 20), - ["singRIGHT-alt"] = myTypes.Vector2(-20, 0) -} -- Vector2s for character sing animations. -module.shared.settings = table -- Parsed settings.json file -module.shared.receptors = table -- List of receptor sprites -module.shared.opponentReceptors = table -- List of opponent's receptor sprites -module.shared.health = number -- Player health. 0-2 -module.shared.speed = number -- Chart speed. Can not be 0 -module.shared.ui = { - timebar = true, - healthIcons = true, -- If halth is false it wont render either way +sharedVars.canStart = boolean -- Tells the game if it can start. Should only change at the onCreate() function and then resuming it through another function like onUpdate() check. +sharedVars.shouldCountdown = boolean -- Will the game countdown or not (used for pre-game cutscenes etc.) Should only change at the onCreate() function and then resuming it through another function like onUpdate() check. +sharedVars.screenSize = Vector2 -- Only usable in module.onCreate() +sharedVars.canvasSize = Vector2 -- Only usable in module.onCreate() +sharedVars.settings = table -- Parsed settings.json file +sharedVars.receptors = table -- List of receptor sprites +sharedVars.opponentReceptors = table -- List of opponent's receptor sprites +sharedVars.health = number -- Player health. 0-2 +sharedVars.speed = number -- Chart speed. Can not be 0 +sharedVars.ui = { + healthIcons = true, -- If health is false it wont render either way health = true score = true, - ratings = true, } -- List of UI toggles -module.shared.zoom = number -- Game zoom. -module.shared.notes = table -- List of notes -module.shared.characters = { +sharedVars.zoom = number -- Game zoom. +sharedVars.notes = table -- List of notes. +sharedVars.holds = table -- List of sustain notes. +sharedVars.characters = { dad = character, bf = character, gf = character