From 0f997c84af4e766365db24a24d360d9d318cddc4 Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Mon, 29 Mar 2021 18:06:35 -0700 Subject: [PATCH] spritemap atlas bullshit? --- source/animate/AnimationAtlas.hx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/animate/AnimationAtlas.hx b/source/animate/AnimationAtlas.hx index 264253637..cd87c39d0 100644 --- a/source/animate/AnimationAtlas.hx +++ b/source/animate/AnimationAtlas.hx @@ -1,11 +1,15 @@ package animate; import flixel.FlxG; +import flixel.addons.ui.FlxUIColorSwatchSelecter.SwatchGraphic; import flixel.graphics.FlxGraphic; import flixel.graphics.frames.FlxAtlasFrames; +import flixel.math.FlxPoint; +import flixel.math.FlxRect; import flixel.system.FlxAssets.FlxGraphicAsset; import haxe.Json; import openfl.Assets; +import openfl.geom.Rectangle; class AnimationAtlas { @@ -44,7 +48,14 @@ class AnimationAtlas // probably nicer way to do this? Oh well var swagSprite:AnimateSprite = sprite.SPRITE; - trace(swagSprite); + var rect = FlxRect.get(swagSprite.x, swagSprite.y, swagSprite.w, swagSprite.h); + + var size = new Rectangle(0, 0, rect.width, rect.height); + + var offset = FlxPoint.get(-size.left, -size.top); + var sourceSize = FlxPoint.get(size.width, size.height); + + frames.addAtlasFrame(rect, sourceSize, offset, swagSprite.name); } return frames;