Hi. I am extending the Image class to create a Character. I have a lot more code in there that is all working as expected. I have a destroy overloaded function as I want it to display a little ‘fade out’ animation before then destroying. When the animation is complete I want to call the destroy super. However this isn’t working, I get a breaking error that super isn’t available. What next?
export class Character extends Phaser.GameObjects.Image {
destroy() {
let self = this;
//Animate
this.scene.tweens.add({
targets: self,
scale: self.scale * 2,
alpha: 0,
ease: 'Power2',
duration: 250,
onComplete: function () {
self.super();
}
})
}
}