ChrisB Posted July 28, 2018 Share Posted July 28, 2018 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 More sharing options...
Recommended Posts