class PlayState
package funkin.play
extends MusicBeatSubState › FlxSubState › FlxState › FlxTypedContainer › FlxTypedGroup › FlxBasic
Available on all platforms
The gameplay state, where all the rhythm gaming happens. SubState so it can be loaded as a child of the chart editor.
Static variables
Constructor
new(?params:Null<PlayStateParams>)
Instantiate a new PlayState.
Parameters:
params | The parameters used to initialize the PlayState. Includes information about what song to play and more. |
|---|
Variables
camCutouts:FlxCamera
The camera which contains, and controls visibility of menus when there are fake cutouts added.
camCutscene:FlxCamera
The camera which contains, and controls visibility of, a video cutscene, dialogue.
cameraBopIntensity:Float = Constants.DEFAULT_BOP_INTENSITY
Camera bop intensity multiplier. Applied to cameraBopMultiplier on camera bops (usually every beat).
cameraBopMultiplier:Float = 1.0
Multiplier for currentCameraZoom for camera bops. Lerped back to 1.0x every frame.
cameraFollowPoint:FlxObject
An empty FlxObject contained in the scene. The current gameplay camera will always follow this object. Tween its position to move the camera smoothly.
It needs to be an object in the scene for the camera to be configured to follow it. We optionally make this a sprite so we can draw a debug graphic with it.
cameraFollowTween:Null<FlxTween>
An FlxTween that tweens the camera to the follow point. Only used when tweening the camera manually, rather than tweening via follow.
cameraZoomRate:Int = Constants.DEFAULT_ZOOM_RATE
How many beats (quarter notes) between camera zooms.
cameraZoomRateOffset:Int = Constants.DEFAULT_ZOOM_OFFSET
How many beats (quarter notes) the zoom rate is offset. For if you want the zoom to happen off-beat.
currentCameraZoom:Float = FlxCamera.defaultZoom
The current camera zoom level without any modifiers applied.
read onlycurrentChart:Null<SongDifficulty>
Data for the current difficulty for the current song. Includes chart data, scroll speed, and other information.
currentStage:Null<Stage> = null
The currently active Stage. This is the object containing all the props.
read onlycurrentStageId:String
The internal ID of the currently active Stage.
Used to retrieve the data required to build the currentStage.
deathCounter:Int = 0
The current 'Blueball Counter' to display in the pause menu. Resets when you beat a song or go back to the main menu.
debugUnbindCameraZoom:Bool = false
Simple helper debug variable, to be able to move the camera around for debug purposes without worrying about the camera tweening back to the follow point.
defaultHUDCameraZoom:Float = FlxCamera.defaultZoom * 1.0
The current HUD camera zoom level.
The camera zoom is increased every beat, and lerped back to this value every frame, creating a smooth 'zoom-in' effect.
disableKeys:Bool = false
Whether the inputs should be disabled for whatever reason... Used after the song ends, and in the Stage Editor.
healthBar:FlxBar
The bar which displays the player's health.
Dynamically updated based on the value of healthLerp (which is based on health).
healthBarBG:FunkinSprite
The background image used for the health bar.
Emma says the image is slightly skewed so I'm leaving it as an image instead of a createGraphic.
hudCameraZoomIntensity:Float = 0.015 * 2.0
Intensity of the HUD camera zoom. Need to make this a multiplier later. Just shoving in 0.015 for now so it doesn't break.
isBotPlayMode:Bool = false
Whether the game is currently in Bot Play Mode. If true, player will not gain or lose score from notes.
isInCutscene:Bool = false
Whether the game is currently in an animated cutscene, and gameplay should be stopped.
isMinimalMode:Bool = false
In Minimal Mode, the stage and characters are not loaded and a standard background is used.
isPlayerDying:Bool = false
Whether the player has dropped below zero health, and we are just waiting for an animation to play out before transitioning.
isPlaytestResults:Bool = false
Whether the results screen should show up before returning to the chart editor.
isPracticeMode:Bool = false
Whether the game is currently in Practice Mode. If true, player will not gain or lose score from notes.
needsReset:Bool = false
Gets set to true when the PlayState needs to reset (player opted to restart or died). Gets disabled once resetting happens.
previousCameraFollowPoint:Null<FlxPoint>
The camera follow point from the last stage.
Used to persist the position of the cameraFollowPosition between levels.
previousDifficulty:String = Constants.DEFAULT_DIFFICULTY
The previous difficulty the player was playing on.
scrollSpeedTweens:Array<FlxTween> = []
An FlxTween that changes the additive speed to the desired amount.
shouldSubstatePause:Bool = false
Determines whether opening a substate over this causes the game to pause. Enable it before opening a Pause menu or Game Over screen, and disable it for stuff like editors and overlays.
read onlystageZoom:Float
Default camera zoom for the current stage. If we aren't in a stage, just use the default zoom (1.05x).
startTimestamp:Float = 0.0
Start at this point in the song once the countdown is done.
For example, if startTimestamp is 30000, the song will start at the 30 second mark.
Used for chart playtesting or practice.
vwooshTimer:FlxTimer = new FlxTimer()
A timer that gets active once resetting happens. Used to vwoosh in notes.
Methods
endSong(rightGoddamnNow:Bool = false):Void
End the song. Handle saving high scores and transitioning to the results screen.
Broadcasts an onSongEnd event, which can be cancelled to prevent the song from ending (for a cutscene or something).
Remember to call endSong again when the song should actually end!
Parameters:
rightGoddamnNow | If true, don't play the fancy animation where you zoom onto Girlfriend. Used after a cutscene. |
|---|
openSubState(subState:FlxSubState):Void
Function called before opening a new substate.
Parameters:
subState | The substate to open. |
|---|
resetCamera(resetZoom:Bool = true, cancelTweens:Bool = true, snap:Bool = true):Void
Resets the camera's zoom level and focus point.
startConversation(conversationId:String):Void
Displays a dialogue cutscene with the given ID. This is used by song scripts to display dialogue.
startCountdown():Void
Prepares to start the countdown. Ends any running cutscenes, creates the strumlines, and starts the countdown. This is public so that scripts can call it.
tweenCameraToFollowPoint(duration:Float = 0, ?ease:Float ‑> Float):Void
Disables camera following and tweens the camera to the follow point manually.
tweenCameraToPosition(x:Float = 0, y:Float = 0, duration:Float = 0, ?ease:Float ‑> Float):Void
Sets the camera follow point's position and tweens the camera there.
tweenCameraZoom(zoom:Float = 1, duration:Float = 0, direct:Bool = false, ?ease:Float ‑> Float):Void
Tweens the camera zoom to the desired amount.
tweenScrollSpeed(?speed:Float, ?duration:Float, ?ease:Float ‑> Float, strumlines:Array<String>):Void
The magical function that shall tween the scroll speed.