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

staticcampaignMisses:Int = 0

Misses for the current week.

View in GitHub

staticcampaignScore:Int = 0

Score for the current week.

View in GitHub

staticchartingMode:Bool = false

Whenever Charting Mode has been enabled for this song.

View in GitHub

staticcoopMode:Bool = false

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

View in GitHub

staticdaPixelZoom:Float = 6

Zoom for the pixel assets.

View in GitHub

staticdeathCounter:Int = 0

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

View in GitHub

staticdifficulty:String = "normal"

The selected difficulty name

View in GitHub

staticfromMods:Bool = false

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

View in GitHub

staticinstance:PlayState = null

Current PlayState instance.

View in GitHub

staticisStoryMode:Bool = false

Whenever the song is being played in Story Mode.

View in GitHub

staticopponentMode:Bool = false

Whenever the song has been started with opponent mode on.

View in GitHub

staticseenCutscene:Bool = false

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

View in GitHub

staticstoryPlaylist:Array<String> = []

The remaining songs in the Story Mode playlist.

View in GitHub

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

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

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

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 = 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)

camGameZoomLerp:Float = 0.05

Speed at which the game camera zoom lerps to.

camHUD:HudCamera

Camera for the HUD (notes, misses).

camHUDZoomLerp:Float = 0.05

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.

camZoomingInterval:Int = 4

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

camZoomingStrength:Float = 1

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

canAccessDebugMenus:Bool = true

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.

read onlycpuStrums:StrumLine

CPU strums.

curCameraTarget:Int = 0

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

curRating:ComboRating

Last rating (may be null)

curSong:String = ""

Current song name (lowercase)

curStage:String

Current stage name

cutscene:String = null

Cutscene script path.

dad:Character

Dad character

defaultCamZoom:Float = 1.05

Camera zoom at which the game lerps to.

defaultHudZoom:Float = 1.0

Camera zoom at which the hud lerps to.

detailsPausedText:String = ""

detailsText:String = ""

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)

endCutscene:String = null

End cutscene script path.

endingSong:Bool = false

Whenever the song is ending or not.

events:Array<ChartEvent> = []

Remaining events

gameOverSong:String = "gameOver"

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.

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 = 5

Length of the intro countdown.

introSounds:Array<String> = ["intro3", "intro2", "intro1", "introGo"]

Array of sounds for the intro.

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

Array of sprites for the intro.

lossSFX:String = "gameOverSFX"

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

maxCamZoom:Float = 1.35

Maximum amount of zoom for the camera.

@:isVarmaxHealth:Float = 2

Maximum health the player can have. Defaults to 2.

misses:Int = 0

The player's amount of misses.

missesTxt:FunkinText

FunkinText that shows your amount of misses.

muteVocalsOnMiss:Bool = true

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.

read onlyplayerStrums:StrumLine

Player strums.

ratingNum:Int = 0

Number of ratings.

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.

scrollSpeed:Float = 0

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

scrollSpeedTween:FlxTween = null

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

addScript(file:String):Void

View in GitHub

countdown(swagCounter:Int):Void

Creates a fake countdown.

View in GitHub

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

saveWarn(closingWindow:Bool = true):Void

View in GitHub

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

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

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

View in GitHub

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

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

openSubState(subState:FlxSubState):Void

SCRIPTING STUFF