1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-09 00:04:42 +00:00
Funkin/source/Character.hx
2020-10-04 15:27:49 -07:00

32 lines
701 B
Haxe

package;
import flixel.FlxSprite;
class Character extends FlxSprite
{
public var animOffsets:Map<String, Array<Dynamic>>;
public var debugMode:Bool = false;
public function new(x:Float, y:Float)
{
animOffsets = new Map<String, Array<Dynamic>>();
super(x, y);
}
public function playAnim(AnimName:String, Force:Bool = false, Reversed:Bool = false, Frame:Int = 0):Void
{
animation.play(AnimName, Force, Reversed, Frame);
var daOffset = animOffsets.get(animation.curAnim.name);
if (animOffsets.exists(animation.curAnim.name))
{
offset.set(daOffset[0], daOffset[1]);
}
}
public function addOffset(name:String, x:Float = 0, y:Float = 0)
{
animOffsets[name] = [x, y];
}
}