AidanDaniel97 Posted November 24, 2016 Share Posted November 24, 2016 hey all, So I have been playing around with animations on my multiplayer game and have made a character walk left, all is fine, but when I try walking right it gives me an error (listed below)? I have loaded the sprite in and everything is fine and I can even make the sprite walk by adding frame 0 into the array... this.playerSprite.animations.add('left', [1,2,3,4,5,6,7,8], 12, true); //Works! this.playerSprite.animations.add('right', [10, 11, 12, 13, 14, 15, 16, 17], 12, true); //Doesnt work! this.playerSprite.animations.add('right', [0,10, 11, 12, 13, 14, 15, 16, 17], 12, true); //Works?! Then I get the error: phaser.js:47587 Uncaught TypeError: Cannot read property 'x' of undefined(…) when it does not work? It is just strange that walking left is fine, walking right is fine with the 0 frame and then take it out and it give an error! Any help would be great, thanks! Edit: Swapped the left and right animation with each other and kept the 0 in the right walk animation and I got the error again, is this something happening to my load order? Edit 2: I fixed this, it was an issue with stopping the animation and playing a new one. Link to comment Share on other sites More sharing options...
Recommended Posts