-
Notifications
You must be signed in to change notification settings - Fork 5
LuaVN design doc
A script is made up of lists of actions and their args. E.g.
script = {
prologue = {
{"SetBackground", {image = "bg/bg1.png", animation = {type = "fadein", time = 0.5}}},
{"PlayMusic", {track = "sound/music/2spooky4me.ogg", loop = true}},
{"AddText", {speakerID = "Ada", textID = "prologue1", instant = false}},
{"AddSprite", {id = "sophia", image = "sprites/sophia2.png", position = {640, 0}, anchor = {800, 200}, animation = {}}
{"JumpToScript", "prologue2"}
},
prologue2 = {
{"AnimateSprite", {id = "sophia", animation = {x = 200, y = 0, time = 1, simultaneous = false}},
{"PlaySound", {sound = "sound/sfx/shatter.wav"}},
{"ShowChoices",
{
{"killThem", function() Spring.Echo("foo") end},
{"spareThem", function() Spring.Echo("bar") end},
}
},
{"ShakeScreen", {time = 2, strength = 50}},
-- ...
}
},
local localeID = "prologue"
return script, localeID
Every widget:Update(dt)
, the VN widget advances by dt
seconds. If it is currently in an animation or writing text, it progresses accordingly. Else, it moves to the next item in the current script, unless the current action pauses at its end (e.g. text by default). Clicking will make it advance to the next part of the script.
Adds text. Pauses the VN afterwards, unless set not to.
Adds a sprite image with the specifiedID and image file, at the specified location, with the specified animation. Anchor should preferably be set in a definition file somewhere but can be overridden if necessary.
Pauses the VN until the user clicks.
Waits for x seconds before progressing to the next item in the script.
###ShakeScreen
Creates a window with two or more buttons; the user clicks one to make a decision.
local sprites = {
sophia = {id = "sophia", image = "bla", position = {}, wantedPosition = {}, speed = 10}
}
Every widget:Update(dt)
, the widget moves the sprites from their current position towards their wantedPosition
by speed/dt
. speed
is assigned whenever the script calls an animation, based on the initial position, wantedPosition
and animation time.
Text speed:
- Slow: 1 character every 0.2 seconds.
- Medium: 1 character every 0.1 seconds
- Fast: instant