Overview
TheBaseCharacter class is the foundation of the character system in Friday Night Funkin’. It handles character rendering, animations, positioning, and gameplay interactions. Characters are stage props that respond to the music and player inputs.
Class Hierarchy
Key Concepts
Character Origin
Characters are positioned relative to their feet (horizontal center, vertical bottom). This makes it easier to position characters on stages consistently.Character Types
Characters have different behaviors based on their type:- BF (Boyfriend): Player character, responds to inputs
- DAD (Opponent): CPU-controlled character
- GF (Girlfriend): Plays combo/drop animations
- OTHER: Only plays idle animations
BaseCharacter
Properties
Unique identifier for the character
Human-readable name of the character
The type of character (BF, DAD, GF, or OTHER)
Tracks how long the character has been singing (in seconds)
Set to true when the character is dead
Point where the camera should focus, centered on the character
Reference to the current stage
Methods
new(id:String, renderType:CharacterRenderType)
Creates a new character instance.
Character ID matching the character data JSON file
Expected render type (must match character data)
resetCharacter(resetCamera:Bool = true):Void
Resets the character to its original state and position.
setScale(scale:Null<Float>):Void
Sets the character’s scale while maintaining foot position.
playSingAnimation(dir:NoteDirection, miss:Bool = false, ?suffix:String = ''):Void
Plays the appropriate singing animation for a note direction.
Direction of the note (LEFT, DOWN, UP, RIGHT)
If true, plays the miss animation instead
Optional suffix for animation name (e.g., ‘alt’)
isSinging():Bool
Checks if the character is currently singing.
getHealthIconId():String
Returns the ID of the health icon for this character.
initHealthIcon(isOpponent:Bool):Void
Initializes the health icon in the PlayState.
Character Implementations
SparrowCharacter
Renders characters using Sparrow V2 atlas spritesheets.- Loads from Sparrow XML atlas
- Supports pixel art mode
- Automatic antialiasing control
AnimateAtlasCharacter
Renders characters using Adobe Animate texture atlas.- Adobe Animate support
- Advanced animation features
- Custom atlas settings
Animation System
Singing Animations
Characters automatically play singing animations when notes are hit:singLEFT,singDOWN,singUP,singRIGHT- Hit animationssingLEFTmiss,singDOWNmiss, etc. - Miss animationssingLEFT-alt,singDOWN-alt, etc. - Alt note animations
Hold Animations
If a-hold animation exists, it plays after the initial sing animation:
singLEFT→singLEFT-hold(looped)- Animation holds until the note is released
End Animations
If an-end animation exists, it plays when releasing a held note:
singLEFT-hold→singLEFT-end→idle
Special Animations
Combo Animations (GF type only):combo50- Plays at 50 combocombo100- Plays at 100 combo
drop10- Plays when dropping a 10+ combodrop50- Plays when dropping a 50+ combo
Event Handlers
onNoteHit(event:HitNoteScriptEvent)
Called when a note is successfully hit.
onNoteMiss(event:NoteScriptEvent)
Called when a note is missed.
onUpdate(event:UpdateScriptEvent)
Called every frame.
Usage Example
Best Practices
The
holdTimer prevents sing animations from flickering between notes. Characters hold sing poses for at least singTime beats (defined in character data).