Add Scripting
parent
3f36387f7b
commit
fb3c87e186
47
Scripting.md
Normal file
47
Scripting.md
Normal file
@ -0,0 +1,47 @@
|
||||
### Here i will define all the functions, arguments and shared variables module / chart / stage scripts can use.
|
||||
|
||||
# Script Functions
|
||||
- `module.onCreate(songName)` -- That function is called whenever the PlayState launches, even before the game fully loads. At this point you usually create the [stage background](https://git.squog.ru/TaggedEngine/TaggedEngine/wiki/Stages).
|
||||
- `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.
|
||||
|
||||
# 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
|
||||
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 = {
|
||||
dad = character,
|
||||
bf = character,
|
||||
gf = character
|
||||
} -- List of characters
|
||||
```
|
||||
|
||||
### For what you can do with notes and characters look at [Notes](https://git.squog.ru/TaggedEngine/TaggedEngine/wiki/Types#note) and [Characters](https://git.squog.ru/TaggedEngine/TaggedEngine/wiki/Types#character)
|
Loading…
x
Reference in New Issue
Block a user