Sprite Character Builder Layers & Anims

New to Phaser (and game dev in general)

I’d like to be able to randomly generate NPC sprites from a collection of character builder sprites with layers and anims. Each “layer” is a separate spritesheet for skinTone, shirt, pants, etc. I’m thinking the best way to go about this is a GameObject.Factory that handles the textures RNG so I can easily add/pool, scene.add.npc(x, y, forcedTextures = {hairColor: 'brown', hairStyle: 'pony'}) (or something like that). And minimize atlas’ and anim definitions since the frames are all consistent.

I’m not quite sure where to start with layer/group/container/nesting sprites to retain and sync animations. The source package I’m using includes a ton of sprite sheets for character styling, but ideally I can just npc.anims.play('walk-left') and each child layer anims in sync.

How would you go about achieving something like this? Container? Group? GameObjectLayer? Can Aseprite help?
Or am I thinking about it all wrong?

Any advice/tutorial/examples would be appreciated!
(note: this is a personal project that will only be run locally, so I’m not incredibly worried about performance)

Sprite source: ThatCoolSprite by Chocolate4

:wave:

Probably a Container of multiple sprites (and multiple animations) or a CanvasTexture where you compose the images directly.

With multiple sprites you’ll still have to define one animation per spritesheet.

1 Like