package; import flixel.FlxSprite; class Character extends FlxSprite { public var animOffsets:Map>; public var debugMode:Bool = false; public function new(x:Float, y:Float) { animOffsets = new Map>(); 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]; } }