Skip to content
This repository was archived by the owner on Dec 30, 2023. It is now read-only.

Character Script

skellypupper edited this page Jan 8, 2023 · 14 revisions

Empty Character Script - Example Character Script

Character scripts are of course used to generate character sprites.

How to use

Make a stage script at assets/<charactername>/init.hx, you can also place your character assets in the <charactername> folder.

Variables

  • char: The current character class (extended FlxSprite), used to edit character data.
  • char.iconName: The name of the icon you want to use for the character. If unset it uses char.curCharacter.
  • char.deadChar: The name of the character to use on the death screen. If unset it uses char.curCharacter.
  • char.bopSpeed: How many beats it takes for the character to dance. If the character is detected having danceLeft and danceRight 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 with x, y, camX, camY.
  • Paths: A custom paths instance that only reads for files inside the <charactername> directory.
  • _Paths: The global paths instance.

Callbacks

Required

  • create(): This is where you create character.

Optional

  • 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.
Clone this wiki locally