Jump to content

AtlasXML Problem


ChrisB
 Share

Recommended Posts

Hi all,

since yesterday i am trying to animate my player. Below is the code:

preload{

        ......

        this.load.atlasXML("player", "assets/sprites.png", "assets/sprites.xml");
        this.anims.create({
            key: "moving",
            frames: this.anims.generateFrameNames("monkey", { start: 0, end: 9, prefix: "idle", suffix: '.png'  }),
            frameRate: 15,
            repeat: -1
        });

}

 

At create:

       var player = this.add.sprite(400, 285, "player", "idle0.png").setDisplaySize(55, 55);

which works great!

But on update where i want to animate my player i am getting this error:

Uncaught TypeError: Cannot read property 'frame' of undefined

It is like the frames array is not populated when i am creating anims on preload.

frames:Array(0) i get at: console.log(this.anims.get("moving"));

Any help would be appreciated!

Thank you

Link to comment
Share on other sites

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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