1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-11-08 07:44:36 +00:00
Funkin/source/Character.hx

32 lines
701 B
Haxe
Raw Normal View History

2020-10-04 22:27:49 +00:00
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];
}
}