Sprite-sheets with different dimensions

39 views
Skip to first unread message

MegaBite

unread,
Mar 16, 2016, 5:23:41 AM3/16/16
to HaxeFlixel
Hey guys and gals!

I'm sorry if this has been asked before, but I can't seem to get my head around sprite-sheets with different dimensions for my characters.
My question is about the position of a graphic, so that if I load a new graphic into a sprite, the character appears to be on the same spot.
How can I change the position of the graphic without changing the position of the sprite object?

Thanks!
MB

Gimmicky Apps

unread,
Mar 16, 2016, 11:25:33 AM3/16/16
to HaxeFlixel
The technique they use with Spriter and pivot points may apply here: just pad the canvas of all your sprites, then you have full control of alignment while laying them out in your image editing software.  Those extra transparent pixels don't cost much in terms of disk space (at least with PNG compression level 1, anyway)...hopefully not in terms of memory either, but I'm not so sure about that part.

MegaBite

unread,
Mar 17, 2016, 4:53:31 AM3/17/16
to HaxeFlixel
Thanks for the quick answer! So there really is no better way to do this and padding the canvas of every sprite is common practice? Because that would mean I'd have to know the maximum size any sprite will have in my game, or I'll have to do a lot of padding at the end which will probably mess up some of my code.

Gimmicky Apps

unread,
Mar 17, 2016, 5:38:58 AM3/17/16
to HaxeFlixel
No prob.  I wouldn't go that far (to say there's no better way)--this was just a suggested possibility because I was using Spriter recently.  You're right about the downsides, I hadn't thought of those.  I'm by no means a HaxeFlixel veteran, so if someone else could chime in, that'd be helpful.  :)
Reply all
Reply to author
Forward
0 new messages