There is no texture key named player
, but instead the “texture” you can see is add with an animation added in the Player class update method which is called by the scene’s update method.
Here is how it look like :
initAnimations() {
// ...
this.scene.anims.create({
key: 'turn',
frames: [{ key: 'dude', frame: 4 }],
frameRate: 20
});
}
update() {
// ...
this.anims.play('turn');
}
And in the Scene class:
update() {
this.player.update();
}
I updated the post to show the “working way” with this.physics.add.sprite
directly in the Scene class.