Skip to main content

Character

Kindclass
Packageobjects
Full nameobjects.Character
Sourcesource/objects/Character.hx
ExtendsFlxSprite

Known subclasses: Boyfriend

Public fields​

NameTypeStaticDefaultNotes
animOffsetsMap<String, Array<Dynamic>>no——
debugModeBoolnofalse—
isPlayerBoolnofalse—
curCharacterStringnoDEFAULT_CHARACTER—
colorTweenFlxTweenno——
holdTimerFloatno0—
heyTimerFloatno0—
specialAnimBoolnofalse—
animationNotesArray<Dynamic>no[]—
stunnedBoolnofalse—
singDurationFloatno4—
idleSuffixStringno''—
danceIdleBoolnofalse—
skipDanceBoolnofalse—
healthIconStringno'face'—
animationsArrayArray<AnimArray>no[]—
noteskinStringno——
positionArrayArray<Float>no[0, 0]—
cameraPositionArray<Float>no[0, 0]—
otherCharactersArray<Character>no——
hasMissAnimationsBoolnofalse—
vocalsFileStringno''—
isDeathCharacterBoolnofalse—
isPlaceholderBoolnofalseTrue when this character is a code-generated stand-in (its JSON, and the DEFAULT_CHARACTER fallback, were both missing). This is always the case for built-in characters in content-stripped (NO_BUILTIN_CONTENT) builds.
healthDrainBoolnofalse—
drainAmountFloatno0—
drainFloorFloatno0—
shakeScreenBoolnofalse—
shakeIntensityFloatno0—
shakeDurationFloatno0—
imageFileStringno''Used on Character Editor
jsonScaleFloatno1—
noAntialiasingBoolnofalse—
originalFlipXBoolnofalse—
editorIsPlayerNull<Bool>nonull—
healthColorArrayArray<Int>no[255, 0, 0]—
trailLengthNull<Int>no4—
trailDelayNull<Int>no24—
trailAlphaNull<Float>no0.3—
trailDiffNull<Float>no0.069—
flixelTrailBoolnofalse—
DEFAULT_CHARACTERStringyes'bf'—
animPausedBoolno—property (get, set)
dancedBoolnofalse—
danceEveryNumBeatsIntno2—
isAnimateAtlasBoolnofalseAtlas support special thanks ne_eo for the references, you're the goat!!
atlasFlxAnimateno—#if flxanimate

Public methods​

dummyFile​

static function dummyFile():CharacterFile

Minimal valid character file used when no JSON could be loaded at all (content-stripped builds, or a typo'd character with no BF fallback). The chart editor uses this so it can open without any characters installed.

View source

placeholderColor​

static function placeholderColor(charName:String):FlxColor

Deterministic stand-in color derived from a character name, so every placeholder (character body, health icon) for the same name matches.

ParameterTypeDefault
charNameString—

View source

new (constructor)​

function new(x:Float, y:Float, character:String = 'bf', isPlayer:Bool = false, isDeathCharacter:Bool = false)
ParameterTypeDefault
xFloat—
yFloat—
character (optional)String'bf'
isPlayer (optional)Boolfalse
isDeathCharacter (optional)Boolfalse

View source

loadCharacterFile​

function loadCharacterFile(json:CharacterFile)
ParameterTypeDefault
jsonCharacterFile—

View source

loadPlaceholderCharacter​

function loadPlaceholderCharacter(charName:String)

Builds a fully functional single-frame stand-in character: a solid box with every animation the engine may request (sing/miss, dance, taunts, death poses). Used when the character JSON (and the BF fallback) could not be loaded, which is always the case for built-in characters in content-stripped (NO_BUILTIN_CONTENT) builds.

ParameterTypeDefault
charNameString—

View source

isAnimationNull​

inline function isAnimationNull():Bool

View source

getAnimationName​

inline function getAnimationName():String

View source

isAnimationFinished​

function isAnimationFinished():Bool

View source

finishAnimation​

function finishAnimation():Void

View source

hasAnimation​

function hasAnimation(anim:String):Bool
ParameterTypeDefault
animString—

View source

dance​

function dance()

FOR GF DANCING SHIT

View source

playAnim​

function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
ParameterTypeDefault
AnimNameString—
Force (optional)Boolfalse
Reversed (optional)Boolfalse
Frame (optional)Int0

View source

recalculateDanceIdle​

function recalculateDanceIdle()

View source

addOffset​

function addOffset(name:String, x:Float = 0, y:Float = 0)
ParameterTypeDefault
nameString—
x (optional)Float0
y (optional)Float0

View source

quickAnimAdd​

function quickAnimAdd(name:String, anim:String)
ParameterTypeDefault
nameString—
animString—

View source

draw​

override function draw()

Only compiled when #if flxanimate.

View source

copyAtlasValues​

function copyAtlasValues()

Only compiled when #if flxanimate.

View source

destroy​

override function destroy()

Only compiled when #if flxanimate.

View source

destroyAtlas​

function destroyAtlas()

Only compiled when #if flxanimate.

View source

Internals​

Private / internal members
FieldTypeStatic
animStringno
_lastPlayedAnimationStringno
daOffset—no
settingCharacterUpBoolno
Method
override function update(elapsed:Float)
function get_animPaused():Bool
function set_animPaused(value:Bool):Bool
function loadMappedAnims():Void
function sortAnims(Obj1:Array<Dynamic>, Obj2:Array<Dynamic>):Int