This repository has been archived by the owner on Dec 30, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Character Script
skellypupper edited this page May 31, 2023
·
14 revisions
Empty Script
Example character scripts can be found here.
// required
function create() {}
// optional
function getIcon() return "face";
function createPost() {}
function update(elapsed:Float) {}
function dance() {}
Make a character script at characters/<charactername>/init.hxs
, you can also place your character assets in the <charactername>
folder.
If the create
callback doesn't finish successfully, a bf will spawn in your character's place.
-
char
: The current character class (extendedFlxSprite
), used to edit character data. -
char.iconName
: The name of the icon you want to use for the character. If unset it useschar.curCharacter
. -
char.deadData
: A data set for the game over screen.-
char.deadData.char
: The name of the character to use on the game over screen, if unset it useschar.curCharacter
. -
char.deadData.sound
: The string path to the death sound to use on the game over screen. -
char.deadData.music
: The string path to the death song used on the game over screen. -
char.deadData.end
: The string path to the concluding sound for the game over screen. -
char.deadData.bpm
: BPM for the death song used on the game over screen.
-
-
char.bopSpeed
: How many beats it takes for the character to dance. If the character is detected havingdanceLeft
anddanceRight
animations, this will be set to 1. -
char.stopAnims
: If true, the character will not respond to any new animation calls. -
char.stopSinging
: If true, the character will not respond to any singing animation calls. -
char.stopDancing
: If true, the character will not respond to any dancing calls (if animation includes "dance" or is "idle"). -
char.displaceData
: A data set withx
,y
,camX
,camY
.x
andy
changes will displace the character sprite,camX
andcamY
will displace where the camera is when focused on the character. -
Paths
: A custom paths instance that only reads for files inside thecharacters/<charactername>
directory. -
_Paths
: The global paths instance.
-
create()
: This is where you create character.
-
getIcon()
: Used to fetch an icon if your character doesn't have one that matches. -
createPost()
: Called after the character class is created. -
update(elapsed:Float)
: Called every frame. -
dance()
: Called when the PlayState calls Character#dance. If used, it completely overrides the original dance function for the target character.
Written for EE v1.1.0