Last active
January 29, 2021 23:37
-
-
Save KinoAR/1ecccce24843842c75e350c84df73b90 to your computer and use it in GitHub Desktop.
Setup for the cutscene-state
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package; | |
//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; | |
super(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment