Jump to content

AtlasXML Problem


Recommended Posts

Hi all,

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



        this.load.atlasXML("player", "assets/sprites.png", "assets/sprites.xml");
            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


  • Recently Browsing   0 members

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