Codename LogoCodename Logo

funkin.game.PlayState

APIWikiTools

Static variables

staticSONG:ChartData

SONG DATA (Chart, Metadata).

staticread onlycampaignAccuracy:Float

Accuracy for the current week.

View on GitHub

staticcampaignMisses:Int = 0

Misses for the current week.

View on GitHub

staticcampaignScore:Int = 0

Score for the current week.

View on GitHub

staticchartingMode:Bool = false

Whenever Charting Mode is enabled for this song.

View on GitHub

staticcoopMode:Bool = Flags.DEFAULT_COOP_MODE

Whenever the song is started with co-op mode on.

View on GitHub

staticdaPixelZoom:Float = Flags.PIXEL_ART_SCALE

Zoom for the pixel assets.

View on GitHub

staticdeathCounter:Int = 0

Death counter on current week (or song if from freeplay).

View on GitHub

staticdifficulty:String = Flags.DEFAULT_DIFFICULTY

The selected difficulty name.

View on GitHub

staticfromMods:Bool = false

Whenever the week is coming from the mods folder or not.

View on GitHub

staticinstance:PlayState = null

Current PlayState instance.

View on GitHub

staticisStoryMode:Bool = false

Whenever the song is being played in Story Mode.

View on GitHub

staticopponentMode:Bool = Flags.DEFAULT_OPPONENT_MODE

Whenever the song is started with opponent mode on.

View on GitHub

staticseenCutscene:Bool = false

Whenever the game has already played a specific cutscene for the current song. Check startCutscene for more details.

View on GitHub

staticstoryPlaylist:Array<String> = []

The remaining songs in the Story Mode playlist.

View on GitHub

staticstoryWeek:WeekData = null

The week data of the current week

Static methods

View on GitHub

static__loadSong(_name:String, _difficulty:String):Void

(INTERNAL) Loads a song without resetting story mode/opponent mode/coop mode values.

Parameters:

name

Song name

difficulty

Song difficulty

View on GitHub

staticloadSong(_name:String, ?_difficulty:String, _opponentMode:Bool = false, _coopMode:Bool = false):Void

Loads a song into PlayState

Parameters:

name

Song name

difficulty

Chart difficulty (if invalid, will load an empty chart)

opponentMode

Whenever opponent mode is on

coopMode

Whenever co-op mode is on.

View on GitHub

staticloadWeek(weekData:WeekData, ?difficulty:String):Void

Load a week into PlayState.

Parameters:

weekData

Week Data

difficulty

Week Difficulty

Constructor

View on GitHub

new(?scriptsAllowed:Bool, ?scriptName:String)

Variables

accFormat:FlxTextFormat = new FlxTextFormat(0xFF888888, false, false, 0)

Format for the accuracy rating.

accuracy:Float

The player's accuracy (shortcut to accuracyPressedNotes / totalAccuracyAmount).

accuracyPressedNotes:Float = 0

The number of pressed notes.

accuracyTxt:FunkinText

FunkinText that shows your accuracy.

allowGitaroo:Bool = Flags.DEFAULT_GITAROO

Whether or not to show the secret gitaroo pause.

bf:Character

Boyfriend character. Same as boyfriend, just shorter.

boyfriend:Character

Boyfriend character.

camFollow:FlxObject

Object defining the camera follow target.

camGame:FlxCamera

Camera for the game (stages, characters).

camGameZoomLerp:Float = Flags.DEFAULT_CAM_ZOOM_LERP

Speed at which the game camera zoom lerps to.

camHUD:HudCamera

Camera for the HUD (notes, misses).

camHUDZoomLerp:Float = Flags.DEFAULT_HUD_ZOOM_LERP

Speed at which the hud camera zoom lerps to.

camZooming:Bool = false

Whenever cam zooming is enabled, enables on a note hit if not cancelled.

camZoomingEvery:BeatType = MEASURE

Beat type for interval of cam zooming. Example: If Beat Type is on STEP and Interval is 2, it'll zoom every 2 steps. NOTE: Will set to BEAT if not found any other time signatures unlike 4/4.

camZoomingInterval:Float = Flags.DEFAULT_CAM_ZOOM_INTERVAL

Interval of cam zooming (in conductor values). Example: If Interval is 1 and Beat Type is on MEASURE, it'll zoom every a measure. NOTE: Will set to 4 if not found any other time signatures unlike 4/4.

camZoomingLastBeat:Float

Stores what was the last beat for the cam zooming intervals.

camZoomingOffset:Float = Flags.DEFAULT_CAM_ZOOM_OFFSET

Number of Conductor values to offset camZooming by.

camZoomingStrength:Float = Flags.DEFAULT_CAM_ZOOM_STRENGTH

How strong the cam zooms should be (defaults to 1).

canAccessDebugMenus:Bool = !Flags.DISABLE_EDITORS

Whenever the player can press 7, 8 or 9 to access the debug menus.

canDadDie:Bool = opponentMode && !coopMode

Whenever the opponent can die.

canDie:Bool = !opponentMode && !coopMode

Whenever the player can die.

canPause:Bool = true

Whenever the game can be paused or not.

combo:Int = 0

Current combo.

comboBreaks:Bool = !Options.ghostTapping

Whenever the misses should show "Combo Breaks" instead of "Misses".

comboGroup:RotatingSpriteGroup

Group containing all of the combo sprites.

comboRatings:Array<ComboRating> = [new ComboRating(0, "F", 0xFFFF4444), new ComboRating(0.5, "E", 0xFFFF8844), new ComboRating(0.7, "D", 0xFFFFAA44), new ComboRating(0.8, "C", 0xFFFFFF44), new ComboRating(0.85, "B", 0xFFAAFF44), new ComboRating(0.9, "A", 0xFF88FF44), new ComboRating(0.95, "S", 0xFF44FFFF), new ComboRating(1, "S++", 0xFF44FFFF)]

All combo ratings.

cpu:StrumLine

Shortcut to cpuStrums.

cpuStrums:StrumLine

CPU strums.

curCameraTarget:Int = 0

Current camera target. -1 means no automatic camera targeting.

curRating:ComboRating

Last rating (may be null).

curSong:String = ""

Current song name (lowercase).

curSongID:String = ""

Current song name (lowercase and spaces to dashes).

curStage:String

Current stage name.

cutscene:String = null

Cutscene script path.

dad:Character

Dad character.

defaultCamZoom:Float = Flags.DEFAULT_CAM_ZOOM

Camera zoom at which the game lerps to.

defaultDisplayCombo:Bool = false

Whenever the Combo sprite should be shown or not (like old Week 7 patches).

NOTE: This is just a default value for the final value, the final value can be changed through notes hit events.

defaultDisplayRating:Bool = true

Whenever the Rating sprites should be shown or not.

NOTE: This is just a default value for the final value, the final value can be changed through notes hit events.

defaultHudZoom:Float = Flags.DEFAULT_HUD_ZOOM

Camera zoom at which the hud lerps to.

detailsPausedText:String = ""

detailsText:String = ""

doIconBop:Bool = Flags.DEFAULT_ICONBOP

Whether or not to bop the icons on beat.

downscroll:Bool

Whenever the game is in downscroll or not. (Can be set)

endCutscene:String = null

End cutscene script path.

endingSong:Bool = false

Whenever the song is ending or not.

events:Array<ChartEvent> = []

Remaining events.

eventsTween:Map<String, FlxTween> = []

gameOverSong:String = Flags.DEFAULT_GAMEOVER_MUSIC

Game Over Song. (assets/music/gameOver.ogg).

generatedMusic:Bool = false

Whenever the music has been generated.

gf:Character

Girlfriend character.

gfSpeed:Int

Interval at which Girlfriend dances.

ghostTapping:Bool = Options.ghostTapping

Whenever Ghost Tapping is enabled.

health:Float = 1

Current health. Goes from 0 to maxHealth (defaults to 2).

healthBar:FlxBar

Health bar.

healthBarBG:FlxSprite

Health bar background.

hitWindow:Float = Options.hitWindow

Hit window, in milliseconds. Defaults to 250ms unless changed in options. Base game hit window is 175ms.

iconArray:Array<HealthIcon> = []

Every active icon that will be updated during gameplay (defaults to iconP1 and iconP1 between create and postCreate in scripts).

iconP1:HealthIcon

Player's icon.

iconP2:HealthIcon

Opponent's icon.

inCutscene:Bool = false

Whenever the game is currently in a cutscene or not.

inst:FlxSound

Instrumental sound (Inst.ogg).

introLength:Int = Flags.DEFAULT_INTRO_LENGTH

Length of the intro countdown.

introSounds:Array<String> = Flags.DEFAULT_INTRO_SOUNDS.copy()

Array of sounds for the intro.

introSprites:Array<String> = Flags.DEFAULT_INTRO_SPRITES.copy()

Array of sprites for the intro.

lossSFX:String = Flags.DEFAULT_GAMEOVERSFX_SOUND

Game Over Song. (assets/sounds/gameOverSFX.ogg).

maxCamZoom:Float = Math.NaN

Maximum amount of zoom for the camera (based on maxCamZoomMult and the camera's zoom IF not set).

maxCamZoomMult:Float = Flags.MAX_CAMERA_ZOOM_MULT

Default multiplier for maxCamZoom.

maxHealth:Float = Flags.DEFAULT_MAX_HEALTH

Maximum health the player can have. Defaults to 2.

minDigitDisplay:Int = 10

Minimum Combo Count to display the combo digits. Anything less than 0 means it won't be shown.

misses:Int = 0

The player's amount of misses.

missesTxt:FunkinText

FunkinText that shows your amount of misses.

muteVocalsOnMiss:Bool = Flags.DEFAULT_MUTE_VOCALS_ON_MISS

Whenever the vocals should be muted when a note is missed.

noteTypesArray:Array<String> = [null]

Array containing all of the note types names.

paused:Bool = false

Whenever the game is paused or not.

playCutscenes:Bool = isStoryMode

Whenever the game should play the cutscenes. Defaults to whenever the game is currently in Story Mode or not.

player:StrumLine

Shortcut to playerStrums.

playerStrums:StrumLine

Player strums.

ratingNum:Int = 0

Number of ratings.

retrySFX:String = Flags.DEFAULT_GAMEOVEREND_SOUND

Game Over End SFX, used when retrying. (assets/sounds/gameOverEnd.ogg).

scoreTxt:FunkinText

FunkinText that shows your score.

scripts:ScriptPack

Script Pack of all the scripts being ran.

scrollSpeed:Float = 0

Current scroll speed for all strums. To set a scroll speed for a specific strum, use strum.scrollSpeed.

songScore:Int = 0

The player's current score.

splashHandler:SplashHandler

Note splashes container.

stage:Stage

Current Stage.

startTimer:FlxTimer

Timer for the start countdown.

startedCountdown:Bool = false

Whenever the countdown has started or not.

startingSong:Bool = false

Whenever the song is currently being started.

strumLine:FlxObject

Strum line position.

strumLines:FlxTypedGroup<StrumLine> = new FlxTypedGroup<StrumLine>()

Array of all the players in the stage.

totalAccuracyAmount:Float = 0

The total accuracy amount.

validScore:Bool = true

Whenever the score will save when you beat the song.

vocals:FlxSound

Vocals sound (Vocals.ogg).

Methods

View on GitHub

addScript(file:String):Void

View on GitHub

inlinecallOnCharacters(func:String, ?parameters:Array<Dynamic>):Void

View on GitHub

countdown(swagCounter:Int):Void

Creates a fake countdown.

View on GitHub

displayRating(myRating:String, ?evt:NoteHitEvent):Void

CALCULATES RATING

View on GitHub

endSong():Void

Ends the song.

View on GitHub

inlinegameAndCharsCall(func:String, ?parameters:Array<Dynamic>, ?charsFunc:String):Void

View on GitHub

inlinegameAndCharsEvent<T>(func:String, ?event:Null<T>, ?charsFunc:String):T

View on GitHub

gameOver(?character:Character, ?deathCharID:String, ?gameOverSong:String, ?lossSFX:String, ?retrySFX:String):Void

Forces a game over.

Parameters:

character

Character which died. Default to boyfriend.

deathCharID

Character ID (name) for game over. Default to whatever is specified in the character's XML.

gameOverSong

Song for the game over screen. Default to this.gameOverSong (gameOver)

lossSFX

SFX at the beginning of the game over (Mic drop). Default to this.lossSFX (gameOverSFX)

retrySFX

SFX played whenever the player retries. Defaults to retrySFX (gameOverEnd)

View on GitHub

dynamicgetCharactersCamPos(chars:Array<Character>, ?pos:FlxPoint, ignoreInvisible:Bool = true):CamPosData

Returns the camera position of the specified characters.

Parameters:

chars

The characters to get the camera position of.

pos

The position to put the camera position in. If null, a new FlxPoint will be created.

ignoreInvisible

Whenever invisible characters should be ignored.

View on GitHub

inlinegetIconRPC():String

Returns the Discord RPC icon.

View on GitHub

inlinegetStrumlineCamPos(strumLine:Int, ?pos:FlxPoint, ignoreInvisible:Bool = true):CamPosData

Returns the camera position of the specified strumline.

Parameters:

strumLine

The strumline to get the camera position of.

pos

The position to put the camera position in. If null, a new FlxPoint will be created.

ignoreInvisible

Whenever invisible characters should be ignored.

View on GitHub

goodNoteHit(strumLine:StrumLine, note:Note):Void

Hits a note

Parameters:

note

Note to hit.

View on GitHub

nextSong():Void

Immediately switches to the next song, or goes back to the Story/Freeplay menu.

View on GitHub

noteMiss(strumLine:StrumLine, note:Note, ?direction:Int, ?player:Int):Void

Misses a note

Parameters:

strumLine

The strumline the miss happened on.

note

Note to miss.

direction

Specify a custom direction in case note is null.

player

Specify a custom player in case note is null.

View on GitHub

pauseGame():Void

Pauses the game.

View on GitHub

saveWarn(closingWindow:Bool = true):Void

View on GitHub

startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:() ‑> Void, checkSeen:Bool = false, canSkipTransIn:Bool = true):Void

Starts a cutscene.

Parameters:

prefix

Custom prefix. Using midsong- will require you to for example rename your video cutscene to songs/song/midsong-cutscene.mp4 instead of songs/song/cutscene.mp4

cutsceneScriptPath

Optional: Custom script path.

callback

Callback called after the cutscene ended. If equals to null, startCountdown will be called.

checkSeen

Bool that by default is false, if true and seenCutscene is also true, it won't play the cutscene but directly call callback (PS: seenCutscene becomes true if the cutscene gets played and checkSeen was true)

canSkipTransIn

Bool that by default is true makes the in transition skip on certain types of cutscenes like dialogues.

View on GitHub

dynamicupdateDiscordPresence():Void

Function used to update Discord Presence.

This function is dynamic, which means you can do updateDiscordPresence = function() {} in scripts.

View on GitHub

updateRating():Void

Updates the rating.

Inherited Variables

Defined by MusicBeatState

cancelConductorUpdate:Bool = false

Whenever the Conductor auto update should be enabled or not.

read onlycontrols:Controls

Game Controls. (All players / Solo)

read onlycontrolsP1:Controls

Game Controls (Player 1 only)

read onlycontrolsP2:Controls

Game Controls (Player 2 only)

read onlycurBeat:Int

Current beat

read onlycurBeatFloat:Float

Current beat, as a Float (ex: 1.24, instead of 1)

read onlycurMeasure:Int

Current beat

read onlycurMeasureFloat:Float

Current beat, as a Float (ex: 1.24, instead of 1)

read onlycurStep:Int

Current step

read onlycurStepFloat:Float

Current step, as a Float (ex: 4.94, instead of 4)

graphicCache:GraphicCacheSprite = new GraphicCacheSprite()

Dummy sprite used to cache graphics to GPU.

scriptName:String = null

scriptsAllowed:Bool = true

read onlysongPos:Float

Current song position (in milliseconds).

stateScripts:ScriptPack

Current injected script attached to the state. To add one, create a file at path "data/states/stateName" (ex: data/states/FreeplayState)

Inherited Methods

Defined by MusicBeatState

View on GitHub

call(name:String, ?args:Array<Dynamic>, ?defaultVal:Dynamic):Dynamic

View on GitHub

event<T>(name:String, event:T):T

View on GitHub

lerp(v1:Float, v2:Float, ratio:Float, fpsSensitive:Bool = false):Float

Shortcut to FlxMath.lerp or CoolUtil.lerp, depending on fpsSensitive

Parameters:

v1

Value 1

v2

Value 2

ratio

Ratio

fpsSensitive

Whenever the ratio should not be adjusted to run at the same speed independent of framerate.

View on GitHub

openSubState(subState:FlxSubState):Void

SCRIPTING STUFF

View on GitHub

startTransition(?newState:FlxState, skipSubStates:Bool = false):Bool