UPDATE: So I decide to switch to Matter Physics which will allow me to use a program called the Physics Editor to create custom shapes for my sprite and exported it into a json file. I’ve also use the TexturePacker to create my spritesheet which will also exported as a json file and a png file.
//load in slime spritesheet created with Texture editor this.load.atlas('slimesheet', 'assets/images/slime_sheet.png', 'assets/images/slime_sheet.json'); //load in slime shapes created with Physics editor this.load.json('shapes', 'assets/images/slime_shapes.json');
//Then I create my slime
var shapes = this.cache.json.get('shapes');
this.slime = this.matter.add.sprite(200, 200, 'slimesheet', '0001.png', {shape: shapes.slime1}).setScale(0.5);
So I succeed on creating my sprite with my custom shape on but I am having trouble on switching the shape on each individual frame of my animation. Is there a animation callback to specify the shapes of each frame? I’m not sure how I do this but this is what I did and it doesn’t work.
this.anims.create({
key: 'walkdown',
frames: [{ key: 'slimesheet', frame: '0001.png', shape: shapes.slime1},
{ key: 'slimesheet', frame: '0002.png', shape: shapes.slime2}],
frameRate: 3,
repeat: -1
});
Does anyone know how I can do this correctly