A Panels comic is meant to be a self-contained, standalone game. You can, however, embed your Panels comics into another game to use them as cutscenes, intros, or other story elements.
Table of contents
Follow the instructions in the main Get Started section to install and import the Panels library.
All the setup instructions apply with one exception:
Do not call
Panels.start() from your game code.
At the point in your game when your cutscene should be triggered call
comicData is the full comic data table for the cutscene you wish to play (1 or more sequences), and
callback is a function in your code that will be called when the cutscene is complete.
While the cutscene is active, continue to call
Panels.update() every frame from your main
When your callback function runs, you can stop calling
Panels.update() and resume your normal game loop. It’s up to your game code to keep track of when a cutscene is running, and to send the appropriate comic data table each time a cutscene starts.
If your cutscene has a branching multiple choice ending, you can receive the user’s choice in your callback function. Panels will send back the
target parameter from the
advanceControls option the user selected.
An example of a branching cutscene ending is shown in the example project.
When using Panels in your project, please include the following (or similar) text in your game credits or about screen:
Cutscenes built with Panels:
Button callbacks and input handlers in your game may continue to get called while the cutscene is running. Make sure to clean up input handlers before starting the cutscene, and check if a cutscene is running in any button handler code.
Remember to stop calling
Panels.update() when the comic ends (after your callback function gets called). Continuing to call
Panels.update() will cause the comic to appear stuck on the last panel.
Neglecting to call
Panels.update() in your update loop will prevent the comic from appearing.
Panels.startCutscene() won’t draw anything to the screen without also calling
Panels.update() every frame.
Panels.startCutscene() will cause your game to crash.
Panels.startCutscene() with an incomplete or invalid comic data table will also crash.
See below for an abbreviated example of the general flow for starting and stopping a cutscene.
Download the full example project for more details:
Panels Cutscene Example
local cutsceneIsPlaying = false
cutsceneIsPlaying = false
cutsceneIsPlaying = true
if cutsceneIsPlaying then
updateGame() -- your game loop