Codename LogoCodename Logo

funkin.game.PlayState

APIWiki

Static variables

staticSONG:ChartData

SONG DATA (Chart, Metadata)

staticread onlycampaignAccuracy:Float

Accuracy for the current week

View in GitHub

@:value(0)staticcampaignAccuracyCount:Float = 0

View in GitHub

@:value(0)staticcampaignAccuracyTotal:Float = 0

View in GitHub

@:value(0)staticcampaignMisses:Int = 0

Misses for the current week.

View in GitHub

@:value(0)staticcampaignScore:Int = 0

Score for the current week.

View in GitHub

@:value(false)staticchartingMode:Bool = false

Whenever Charting Mode has been enabled for this song.

View in GitHub

@:value(false)staticcoopMode:Bool = false

Whenever the song has been started with co-op mode on.

View in GitHub

@:value(6)staticdaPixelZoom:Float = 6

Zoom for the pixel assets.

View in GitHub

@:value(0)staticdeathCounter:Int = 0

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

View in GitHub

@:value("normal")staticdifficulty:String = "normal"

The selected difficulty name

View in GitHub

@:value(false)staticfromMods:Bool = false

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

View in GitHub

@:value(null)staticinstance:PlayState = null

Current PlayState instance.

View in GitHub

@:value(false)staticisStoryMode:Bool = false

Whenever the song is being played in Story Mode.

View in GitHub

@:value(false)staticopponentMode:Bool = false

Whenever the song has been started with opponent mode on.

View in GitHub

@:value(false)staticseenCutscene:Bool = false

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

View in GitHub

@:value([])staticstoryPlaylist:Array<String> = []

The remaining songs in the Story Mode playlist.

View in GitHub

@:value(null)staticstoryWeek:WeekData = null

The week data of the current week

Static methods

View in 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 in GitHub

@:value({ coopMode : false, opponentMode : false, difficulty : "normal" })staticloadSong(name:String, difficulty:String = "normal", 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 in GitHub

@:value({ difficulty : "normal" })staticloadWeek(weekData:WeekData, difficulty:String = "normal"):Void

Load a week into PlayState.

Parameters:

weekData

Week Data

difficulty

Week Difficulty

Constructor

View in GitHub

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

Variables

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

Format for the accuracy rating.

accuracy:Float

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

@:value(0)accuracyPressedNotes:Float = 0

The number of pressed notes.

accuracyTxt:FunkinText

FunkinText that shows your accuracy.

@:value(true)allowGitaroo:Bool = true

Whether or not to show the secret gitaroo pause.

boyfriend:Character

Boyfriend character

camFollow:FlxObject

Object defining the camera follow target.

camGame:FlxCamera

Camera for the game (stages, characters)

@:value(0.05)camGameZoomLerp:Float = 0.05

Speed at which the game camera zoom lerps to.

camHUD:HudCamera

Camera for the HUD (notes, misses).

@:value(0.05)camHUDZoomLerp:Float = 0.05

Speed at which the hud camera zoom lerps to.

@:value(false)camZooming:Bool = false

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

@:value(4)camZoomingInterval:Int = 4

Interval of cam zooming (beats). For example: if set to 4, the camera will zoom every 4 beats.

@:value(1)camZoomingStrength:Float = 1

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

@:value(true)canAccessDebugMenus:Bool = true

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

@:value(opponentMode &amp;&amp; !coopMode)canDadDie:Bool = opponentMode && !coopMode

Whenever the opponent can die.

@:value(!opponentMode &amp;&amp; !coopMode)canDie:Bool = !opponentMode && !coopMode

Whenever the player can die.

@:value(true)canPause:Bool = true

Whenever the game can be paused or not.

@:value(0)combo:Int = 0

Current combo.

@:value(!Options.ghostTapping)comboBreaks:Bool = !Options.ghostTapping

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

comboGroup:RotatingSpriteGroup

Group containing all of the combo sprites.

@:value([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)])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.

read onlycpuStrums:StrumLine

CPU strums.

@:value(0)curCameraTarget:Int = 0

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

curRating:ComboRating

Last rating (may be null)

@:value("")curSong:String = ""

Current song name (lowercase)

@:value("")curStage:String = ""

Current stage name

@:value(null)cutscene:String = null

Cutscene script path.

dad:Character

Dad character

@:value(1.05)defaultCamZoom:Float = 1.05

Camera zoom at which the game lerps to.

@:value(1.0)defaultHudZoom:Float = 1.0

Camera zoom at which the hud lerps to.

@:value("")detailsPausedText:String = ""

@:value("")detailsText:String = ""

@:value(true)doIconBop:Bool = true

Whether or not to bop the icons on beat.

downscroll:Bool

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

@:value(null)endCutscene:String = null

End cutscene script path.

@:value(false)endingSong:Bool = false

Whenever the song is ending or not.

@:value([])events:Array<ChartEvent> = []

Remaining events

@:value("gameOver")gameOverSong:String = "gameOver"

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

@:value(false)generatedMusic:Bool = false

Whenever the music has been generated.

gf:Character

Girlfriend character

gfSpeed:Int

Interval at which Girlfriend dances.

@:value(Options.ghostTapping)ghostTapping:Bool = Options.ghostTapping

Whenever Ghost Tapping is enabled.

@:value(1)health:Float = 1

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

healthBar:FlxBar

Health bar.

healthBarBG:FlxSprite

Health bar background.

@:value(Options.hitWindow)hitWindow:Float = Options.hitWindow

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

iconP1:HealthIcon

Player's icon

iconP2:HealthIcon

Opponent's icon

@:value(false)inCutscene:Bool = false

Whenever the game is currently in a cutscene or not.

inst:FlxSound

Instrumental sound (Inst.ogg).

@:value(5)introLength:Int = 5

Length of the intro countdown.

@:value(["intro3", "intro2", "intro1", "introGo"])introSounds:Array<String> = ["intro3", "intro2", "intro1", "introGo"]

Array of sounds for the intro.

@:value([null, "game/ready", "game/set", "game/go"])introSprites:Array<String> = [null, "game/ready", "game/set", "game/go"]

Array of sprites for the intro.

@:value("gameOverSFX")lossSFX:String = "gameOverSFX"

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

@:value(1.35)maxCamZoom:Float = 1.35

Maximum amount of zoom for the camera.

@:value(2)@:isVarmaxHealth:Float = 2

Maximum health the player can have. Defaults to 2.

@:value(0)misses:Int = 0

The player's amount of misses.

missesTxt:FunkinText

FunkinText that shows your amount of misses.

@:value(true)muteVocalsOnMiss:Bool = true

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

@:value([null])noteTypesArray:Array<String> = [null]

Array containing all of the note types names.

@:value(false)paused:Bool = false

Whenever the game is paused or not.

@:value(isStoryMode)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.

read onlyplayerStrums:StrumLine

Player strums.

@:value(0)ratingNum:Int = 0

Number of ratings.

@:value("gameOverEnd")retrySFX:String = "gameOverEnd"

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.

@:value(0)scrollSpeed:Float = 0

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

@:value(null)scrollSpeedTween:FlxTween = null

@:value(0)songScore:Int = 0

The player's current score.

splashHandler:SplashHandler

Note splashes container

stage:Stage

Current Stage.

startTimer:FlxTimer

Timer for the start countdown

@:value(false)startedCountdown:Bool = false

Whenever the countdown has started or not.

@:value(false)startingSong:Bool = false

Whenever the song is currently being started.

strumLine:FlxObject

Strum line position

@:value(new FlxTypedGroup&lt;StrumLine&gt;())strumLines:FlxTypedGroup<StrumLine> = new FlxTypedGroup<StrumLine>()

Array of all the players in the stage.

@:value(0)totalAccuracyAmount:Float = 0

The total accuracy amount.

@:value(true)validScore:Bool = true

Whenever the score will save when you beat the song.

vocals:FlxSound

Vocals sound (Vocals.ogg).

Methods

View in GitHub

addScript(file:String):Void

View in GitHub

countdown(swagCounter:Int):Void

Creates a fake countdown.

View in GitHub

@:value({ evt : null })displayCombo(?evt:NoteHitEvent):Void

View in GitHub

@:value({ evt : null })displayRating(myRating:String, ?evt:NoteHitEvent):Void

View in GitHub

endSong():Void

Ends the song.

View in 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 in GitHub

inlinegetIconRPC():String

Returns the Discord RPC icon.

View in GitHub

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

Hits a note

Parameters:

note

Note to hit.

View in GitHub

nextSong():Void

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

View in 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 in GitHub

pauseGame():Void

Pauses the game.

View in GitHub

@:value({ closingWindow : true })saveWarn(closingWindow:Bool = true):Void

View in GitHub

@:value({ checkSeen : false, prefix : "" })startCutscene(prefix:String = "", ?cutsceneScriptPath:String, ?callback:() ‑> Void, checkSeen:Bool = false):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)

View in GitHub

dynamicupdateDiscordPresence():Void

Function used to update Discord Presence. This function is dynamic, which means you can do updateDiscordPresence = function() {} in scripts.

View in GitHub

updateRating():Void

Updates the rating.

Inherited Variables

Defined by MusicBeatState

@:value(false)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)

@:value(new GraphicCacheSprite())graphicCache:GraphicCacheSprite = new GraphicCacheSprite()

Dummy sprite used to cache graphics to GPU.

@:value(null)scriptName:String = null

@:value(true)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 in GitHub

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

View in GitHub

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

View in GitHub

@:value({ fpsSensitive : false })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 in GitHub

openSubState(subState:FlxSubState):Void

SCRIPTING STUFF