For some characters which use Sparrow atlases, the spritesheets need to be split into multiple files. This character renderer concatenates these together into a single sprite.

Examples in base game include BF Holding GF (most of the sprites are in one file but the death animation is in a separate file). Only example I can think of in mods is Tricky (which has a separate file for each animation).

BaseCharacter has game logic, MultiSparrowCharacter has only rendering logic. KEEP THEM SEPARATE!

Constructor

new(id:String)

Methods

Inherited Variables

Defined by BaseCharacter

@:value(new FlxPoint(0, 0))read onlycameraFocusPoint:FlxPoint = new FlxPoint(0, 0)

Returns the point the camera should focus on. Should be approximately centered on the character, and should not move based on the current animation.

Set the position of this rather than reassigning it, so that anything referencing it will not be affected.

read onlycharacterId:String

read onlycharacterName:String

read onlycharacterOrigin:FlxPoint

The offset between the corner of the sprite and the origin of the sprite (at the character's feet). cornerPosition = stageData - characterOrigin

@:value(OTHER)characterType:CharacterType = OTHER

Whether the player is an active character (Boyfriend) or not.

read onlycomboNoteCounts:Array<Int>

This character plays a given animation when hitting these specific combo numbers.

cornerPosition:FlxPoint

The absolute position of the top-left of the character. @return

curNoteKind:NoteKind

The current note kind.

@:value(false)debug:Bool = false

Set to true when the character being used in a special way. This includes the Chart Editor and the Animation Editor.

Used by scripts to ensure that they don't try to run code to interact with the stage when the stage doesn't actually exist.

read onlydropNoteCounts:Array<Int>

This character plays a given animation when dropping combos larger than these numbers.

read onlyfeetPosition:FlxPoint

The absolute position of the character's feet, at the bottom-center of the sprite.

@:value(0)holdTimer:Float = 0

Tracks how long, in seconds, the character has been playing the current sing animation. This is used to ensure that characters play the sing animations for at least one beat, preventing them from reverting to the idle animation between notes.

@:value(false)isDead:Bool = false

Set to true when the character dead. Part of the handling for death animations.

Defined by Bopper

@:value(new Map<String,Array<Float>>())animationOffsets:Map<String, Array<Float>> = new Map<String,Array<Float>>()

Offset the character's sprite by this much when playing each animation.

@:value(true)canPlayOtherAnims:Bool = true

@:value(0.0)danceEvery:Float = 0.0

The bopper plays the dance animation once every danceEvery beats. Set to 0 to disable idle animation. Supports up to 0.25 precision.

@:value([0, 0])globalOffsets:Array<Float> = [0, 0]

The offset of the character relative to the position specified by the stage.

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

Add a suffix to the idle animation (or danceLeft and danceRight animations) that this bopper will play.

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

@:value(false)isPixel:Bool = false

If this bopper is rendered with pixel art, disable anti-aliasing.

@:value(new FlxPoint(0, 0))originalPosition:FlxPoint = new FlxPoint(0, 0)

@:value(null)shouldAlternate:Null<Bool> = null

Whether the bopper should dance left and right. - If true, alternate playing danceLeft and danceRight. - If false, play idle every time.

You can manually set this value, or you can leave it as null to determine it automatically.

@:value(true)shouldBop:Bool = true

Whether this bopper should bop every beat. By default it's true, but when used for characters/players, it should be false so it doesn't cut off their animations!!!!!

Defined by StageProp

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

An internal name for this prop.

Inherited Methods

Defined by BaseCharacter

getBaseScale():Float

getDataFlipX():Bool

Gets the value of flipX from the character data. !getFlipX() is the direction Boyfriend should face.

getDeathCameraOffsets():Array<Float>

getDeathQuote():Null<String>

initHealthIcon(isOpponent:Bool):Void

isSinging():Bool

onNoteGhostMiss(event:GhostMissNoteScriptEvent):Void

Every time a wrong key is pressed, play the miss animation if we are Boyfriend.

onNoteHit(event:HitNoteScriptEvent):Void

Every time a note is hit, check if the note is from the same strumline. If it is, then play the sing animation.

onNoteMiss(event:NoteScriptEvent):Void

Every time a note is missed, check if the note is from the same strumline. If it is, then play the sing animation.

@:value({ suffix : "", miss : false })playSingAnimation(dir:NoteDirection, miss:Bool = false, suffix:String = ""):Void

Play the appropriate singing animation, for the given note direction.

Parameters:

dir

The direction of the note.

miss

If true, play the miss animation instead of the sing animation.

suffix

A suffix to append to the animation name, like alt.

@:value({ resetCamera : true })resetCharacter(resetCamera:Bool = true):Void

Reset the character so it can be used at the start of the level. Call this when restarting the level.

setScale(scale:Null<Float>):Void

Set the character's sprite scale to the appropriate value.

Parameters:

scale

The desired scale.

Defined by Bopper

forceAnimationForDuration(name:String, duration:Float):Void

Parameters:

name

The animation to play.

duration

The duration in which other (non-forced) animations will be skipped, in seconds (NOT MILLISECONDS).

onResume(event:ScriptEvent):Void

onStepHit(event:SongTimeScriptEvent):Void

Called once every step of the song.

resetPosition():Void

If this Bopper was defined by the stage, return the prop to its original position.

setAnimationOffsets(name:String, xOffset:Float, yOffset:Float):Void

Defined by StageProp

onAdd(event:ScriptEvent):Void

Called when this prop is added to the stage.

Parameters:

null

event

Defined by FunkinSprite

clone():FunkinSprite

Ensure scale is applied when cloning a sprite.R The default clone() method acts kinda weird TBH.

Returns:

A clone of this sprite.

getCurrentAnimation():String

Gets the current animation ID.

getDefaultAtlasSettings():AtlasSpriteSettings

Gets the default settings for a texture atlas sprite.

Returns:

The default settings for a texture atlas sprite.

getDefaultSymbol():String

Returns the default symbol in the atlas.

getFirstElement(symbol:String):Null<Element>

Returns the first element of a symbol in the atlas.

Parameters:

symbol

The symbol to get elements from.

Returns:

The first element of the symbol. WARNING: Can be null.

getFrameLabel(name:String):Null<Frame>

Gets a frame label by its name.

Parameters:

name

The name of the frame label to retrieve.

Returns:

The frame label, or null if it doesn't exist.

getFrameLabelList():Array<String>

Gets a list of frame labels from the default timeline.

getFramesWithKeyword(keyword:String):Array<Frame>

Gets every frame on every symbol that starts with the given keyword.

Parameters:

keyword

The keyword to search for.

Returns:

An array of frames.

getSymbolElements(symbol:String):Array<Element>

Returns the elements of a symbol in the atlas.

Parameters:

symbol

The symbol to get elements from.

hasAnimation(id:String):Bool

Whether or not this sprite has an animation with the given ID.

Parameters:

id

The ID of the animation to check.

isAnimationDynamic(id:String):Bool

Parameters:

id

The animation ID to check.

Returns:

Whether the animation is dynamic (has multiple frames). false for static, one-frame animations.

isAnimationFinished():Bool

Whether or not the current animation is finished.

listAnimations():Array<String>

Returns:

A list of all the animations this sprite has available.

@:value({ cache : true })loadBitmapData(input:BitmapData, cache:Bool = true):FunkinSprite

Apply an OpenFL BitmapData to this sprite.

Parameters:

input

The OpenFL BitmapData to apply

Returns:

This sprite, for chaining

loadPacker(key:String):FunkinSprite

Load an animated texture (Packer atlas spritesheet) as the sprite's texture.

Parameters:

key

The key of the texture to load.

Returns:

This sprite, for chaining.

loadSparrow(key:String):FunkinSprite

Load an animated texture (Sparrow atlas spritesheet) as the sprite's texture.

Parameters:

key

The key of the texture to load.

Returns:

This sprite, for chaining.

loadTexture(key:String):FunkinSprite

Load a static image as the sprite's texture.

Parameters:

key

The key of the texture to load.

Returns:

This sprite, for chaining.

@:value({ fade : false })loadTextureAsync(key:String, fade:Bool = false):Void

loadTextureAtlas(key:Null<String>, ?assetLibrary:String, ?settings:Null<AtlasSpriteSettings>):FunkinSprite

Loads an Adobe Animate texture atlas as the sprite's texture.

Parameters:

key

The key of the texture to load.

settings

Additional settings for loading the atlas.

Returns:

This sprite, for chaining.

loadTextureBase(input:TextureBase):Null<FunkinSprite>

Apply an OpenFL TextureBase to this sprite.

Parameters:

input

The OpenFL TextureBase to apply

Returns:

This sprite, for chaining

@:value({ color : FlxColor.WHITE })makeSolidColor(width:Int, height:Int, color:FlxColor = FlxColor.WHITE):FunkinSprite

Acts similarly to makeGraphic, but with improved memory usage, at the expense of not being able to paint onto the resulting sprite.

Parameters:

width

The target width of the sprite.

height

The target height of the sprite.

color

The color to fill the sprite with.

Returns:

This sprite, for chaining.

@:value({ adjustScale : true })replaceSymbolGraphic(symbol:String, ?graphic:FlxGraphicAsset, adjustScale:Bool = true):Void

Replaces the graphic of a symbol in the atlas.

Parameters:

symbol

The symbol to replace.

graphic

The new graphic to use.

adjustScale

Whether to adjust the scale of new frame to match the old one.

@:value({ scaleEverything : false, positionOffset : 0 })scaleElement(element:Element, scale:Float, positionOffset:Float = 0, scaleEverything:Bool = false):Void

Scales an element by a certain multiplier.

Parameters:

element

The element to scale.

scale

The scale multiplier.

positionOffset

The offset to apply to tx and ty after scaling. (Or in other words, the position of the element.)