Make icon origin add with offsets instead of being explicitly set

This commit is contained in:
MadBear422 2024-05-11 16:42:50 -07:00
parent 9c867b1dac
commit 6d5c688027
3 changed files with 14 additions and 10 deletions

2
assets

@ -1 +1 @@
Subproject commit 37825397730f03e89277791af54e8482bde43e70
Subproject commit 9c98b21f6b05c640522ca537bb173eef12523e34

View File

@ -419,7 +419,7 @@ class CharacterDataParser
static final DEFAULT_NAME:String = 'Untitled Character';
static final DEFAULT_OFFSETS:Array<Float> = [0, 0];
static final DEFAULT_HEALTHICON_OFFSETS:Array<Int> = [0, 25];
static final DEFAULT_PIXELICON_ORIGIN:Array<Int> = [100, 0];
static final DEFAULT_PIXELICON_ORIGIN_OFFSETS:Array<Int> = [0, 0];
static final DEFAULT_RENDERTYPE:CharacterRenderType = CharacterRenderType.Sparrow;
static final DEFAULT_SCALE:Float = 1;
static final DEFAULT_SCROLL:Array<Float> = [0, 0];
@ -517,7 +517,7 @@ class CharacterDataParser
{
id: null,
flipX: null,
origin: null
originOffsets: null
};
}
@ -531,9 +531,9 @@ class CharacterDataParser
input.pixelIcon.flipX = DEFAULT_FLIPX;
}
if (input.pixelIcon.origin == null)
if (input.pixelIcon.originOffsets == null)
{
input.pixelIcon.origin = DEFAULT_PIXELICON_ORIGIN;
input.pixelIcon.originOffsets = DEFAULT_PIXELICON_ORIGIN_OFFSETS;
}
if (input.startingAnimation == null)
@ -810,10 +810,10 @@ typedef PixelIconData =
var flipX:Null<Bool>;
/**
* The origin of the pixel icon, in pixels.
* @default [100, 0]
* The origin offsets of the pixel icon, in pixels.
* @default [0, 0]
*/
var origin:Null<Array<Int>>;
var originOffsets:Null<Array<Int>>;
}
typedef DeathData =

View File

@ -202,8 +202,12 @@ class SongMenuItem extends FlxSpriteGroup
pixelIcon.loadGraphic(Paths.image(charPath));
pixelIcon.scale.x = pixelIcon.scale.y = 2;
// Set the pixel icon x origin for position adjustments
pixelIcon.origin.x = charPixelIconData.origin[0];
// Set to 100 for default position
pixelIcon.origin.x = 100;
// Add the pixel icon origin with offsets for position adjustments
pixelIcon.origin.x += charPixelIconData.originOffsets[0];
pixelIcon.origin.y += charPixelIconData.originOffsets[1];
// Set whether or not to flip the pixel icon
pixelIcon.flipX = charPixelIconData.flipX;
}