Skip to content

Instantly share code, notes, and snippets.

Last active Jan 29, 2021
What would you like to do?
Setup for the cutscene-state
//Imports for the FlxState
import flixel.addons.text.FlxTypeText;
import flixel.text.FlxText;
import flixel.FlxState;
// Type Information to create a delay that you want for each individual text that appears on screen
typedef SceneText = {
public var text:String;
* Delay in seconds
public var delay:Int;
class CutsceneState extends FlxState {
public var sceneText:FlxTypeText;
public var textIndex:Int; //Text index to determine which text to display
public var textList:Array<SceneText>; //Text list for al lthe text in the cutscene
public var nextState:FlxState; //State that we want to transition to after the cutscene
public var skipBar:FlxBar; //Bar displayed on screen for when trying to skip
public var skipText:FlxText; //Text for skipping
public var skipThreshold:Float; //Skip Delay aka threshold for when skip is is complete
public var skipPerc:Int; //Percentage using Integers
/** * Delay before transitioning to the next text in seconds.
public var textDelay:Float; //Delay before switching to another text option
//Static variables used for setting up some basic types
public static inline var TEXT_WIDTH:Int = 400;
public static inline var INIT_TEXT_DELAY:Int = 3;
public static inline var SKIP_THRESHOLD:Float = 2.5;
public function new(newState:FlxState, textInfo:Array<SceneText>) {
textIndex = -1;
skipThreshold = 0;
skipPerc = 0;
textList = textInfo;
nextState = newState;
textDelay = 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment