Hello everyone,
I’m new to phaser and having trouble while playing animation when the bullet collides with the enemy. When the collision happens explosion animation does not play.
code:
this.load.spritesheet('explosion', './assets/explosion1.png', { frameWidth: 400, frameHeight: 48 });
this.anims.create({
key: 'explode',
frames: this.anims.generateFrameNumbers('explosion', { start: 0, end: 7 }),
frameRate: 10,
repeat: -1,
hideOnComplete: true
});
this.explosion = new Explosion(this, enemy.x, enemy.y);
class Explosion extends Phaser.Physics.Arcade.Sprite{
constructor(scene,x,y){
super(scene,x,y);
scene.add.existing(this);
this.play('explode');
}
}
project link: GitHub - maheshnnaik/Phaser3-project
Thank You