Adding sprite and playing animation

I have a small issue that and I’m not able to figure out what’s wrong, maybe someone can help.

It seems player.anims.play(‘walk’) is not working I get an error which reads “Cannot read property ‘frame’ of undefined”.

I get an empty array of frames.

How I load my spreadsheet in preload() :

this.load.spritesheet('player', 'assets/characters.png', { frameWidth: 32, frameHeight: 48 })

How my class looks :

in create():

this.player = new Player(this, 10, 10)

Found the solution myself I’m using Phaser 3.21.0 and it seems that inside this.load.spritesheet I have to pass endFrame inside config object

1 Like