Jump to content

texturepacker to a sprite sheet of many different entities


Recommended Posts


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 {

    this.load.atlas('players', 'img/players.png', 'data/players.json');

    this.player = this.add.sprite(400, 300, 'players');
        key: 'move',
        frames: this.anims.generateFrameNumbers('players', {
            start: 4,
            end: 6
        frameRate: 10,
        repeat: -1

    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 by aylictal
missed quote
Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...