# How to alter sprite hitbox in sprite animation

**URL:** <https://phaser.discourse.group/t/how-to-alter-sprite-hitbox-in-sprite-animation/819>\
**Category:** Phaser 3\
**Created:** [January 18, 2019, 4:27pm UTC](https://phaser.discourse.group/t/how-to-alter-sprite-hitbox-in-sprite-animation/819 "2019-01-18T16:27:18Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Nivlecs](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/nivlecs/32/530_2.png) [@Nivlecs](https://phaser.discourse.group/u/Nivlecs)\
**Post date:** [January 21, 2019, 9:43pm UTC](https://phaser.discourse.group/t/how-to-alter-sprite-hitbox-in-sprite-animation/819/5 "2019-01-21T21:43:35Z")

</div>

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 😬

---

_[View the full topic](https://phaser.discourse.group/t/how-to-alter-sprite-hitbox-in-sprite-animation/819)._
