I am trying to load in animations for my player character but am running into this error. I’m not sure what I’m doing wrong, the error seems to be coming from the setCurrentFrame function in phaser gameObject.texture = animationFrame.frame.texture;
The console log in my create function is returning an entry so i believe i’ve called the animation correctly
preload() {
this.load.atlas('hero', 'assets/images/hero-girl.png', 'assets/images/hero-girl_atlas.json');
this.load.animation('hero_anim', 'assets/images/hero-girl_anim.json');
}
create() {
this.player = new Phaser.Physics.Matter.Sprite(this.matter.world, 0, 0, 'hero', 'girl-idle-3');
this.add.existing(this.player);
this.inputKeys = this.input.keyboard.addKeys({
up: Phaser.Input.Keyboard.KeyCodes.W,
down: Phaser.Input.Keyboard.KeyCodes.S,
left: Phaser.Input.Keyboard.KeyCodes.A,
right: Phaser.Input.Keyboard.KeyCodes.D,
});
console.log('anims', this.anims.anims.entries.hero_walk);
}
update() {
this.player.anims.play('hero_walk');