package cinematic
Package cinematic frames a scripted scene: black bars at the top and bottom of the screen and a Skip button, while the script plays the scene with timers and the dialog package.
cinematic.Begin(player.Everyone, func() { openTheGate() })
dialog.Say(player.Everyone, "Mira", "Now!", 3)
event.After(3, func() { cinematic.Finish(player.Everyone) })Skip is the player's click on the button, which the game records like any input, so a replay skips at the same step. Write a scene so that its end state does not depend on watching it: the function given to Begin runs when the scene is skipped, and the script's own timers may still fire later, so test Skipped() before doing a step twice. Nothing here pauses the simulation; it keeps running behind the bars.
import "aqua4/cinematic"Functions
Active
func Active() boolActive reports whether a scene is playing.
Begin
func Begin(who player.ID, skip func())Begin puts the bars up for who and shows Skip. onSkip is called once if the player skips; it
should leave the game in the state the scene would have ended in.
Finish
func Finish(who player.ID)Finish takes the bars away when the scene ended by itself.
Skipped
func Skipped() boolSkipped reports whether the player skipped the scene that is playing or played last.