aylictal Posted April 1, 2018 Share Posted April 1, 2018 (edited) Hello- I recently started a phaser 3 project and it has been nice so far. I use Tiled and got a huge tilemap in my game and am really happy with it so far. What i need help with is to load an atlas sprite sheet and then create animations off of that sprite sheet. I tried doing this using something like this: class Level1 extends Phaser.Scene { preload(){ this.load.atlas('players', 'img/players.png', 'data/players.json'); } create(){ this.player = this.add.sprite(400, 300, 'players'); this.player.setScale(2); this.anims.create({ key: 'move', frames: this.anims.generateFrameNumbers('players', { start: 4, end: 6 }), frameRate: 10, repeat: -1 }); } update(){ if (this.cursors.left.isDown){ this.player.anims.play('move', true); } else if (this.cursors.right.isDown){ this.player.anims.play('move', true); } } } Is this possible, and if so is there a good tut of doing this? I have lots of sprites i want to incorporate and they're all packed into the same file, but I only wish to designate certain frames as the respective animations. Currently gettin exception: phaser.js:82237 Uncaught TypeError: Cannot read property 'frame' of undefined at Animation.updateFrame (phaser.js:82237) at Animation.load (phaser.js:75059) at AnimationManager.load (phaser.js:74039) at Animation.load (phaser.js:81840) at Animation.play (phaser.js:81924) at Overworld.update (Overworld.js:49) at Systems.step (phaser.js:30316) at SceneManager.update (phaser.js:62911) at Game.step (phaser.js:115769) at TimeStep.step (phaser.js:112963) Edited April 1, 2018 by aylictal missed quote Link to comment Share on other sites More sharing options...
aylictal Posted April 1, 2018 Author Share Posted April 1, 2018 I see in texturepacker that there is a way to export using phaser 3 project, but I have no idea how to do this unfortunately Link to comment Share on other sites More sharing options...
MagP Posted May 10, 2018 Share Posted May 10, 2018 I upload the player as an spritesheet rather than atlas, but then you need to select which sprites need to be taken at a time. Link to comment Share on other sites More sharing options...
AndreasLoew Posted May 10, 2018 Share Posted May 10, 2018 We have a complete tutorial here: https://www.codeandweb.com/texturepacker/tutorials/how-to-create-sprite-sheets-for-phaser3 squilibob 1 Link to comment Share on other sites More sharing options...
Recommended Posts