Jaksndosjnja Posted February 25, 2019 Share Posted February 25, 2019 I am creating a game in phaser 3 where I need to work with texture atlas. There are no useful tutorial available online and I have no idea how to even start. So here are my questions. 1) How to load a JSON atlas and draw images from it? 2) How to randomly select a texture from the atlas and draw it? Note : While packing my textures I selected JSON array option. Some tutorials which I found online. LoadingTextures RandomTexture AddingAtlas Quote Link to comment Share on other sites More sharing options...
HongPong Posted March 5, 2019 Share Posted March 5, 2019 I also took a shot at this and could not get animations to work inside a standalone sprite class, nor any solid tutorials on this specifically. Quote Link to comment Share on other sites More sharing options...
Bush91 Posted March 7, 2019 Share Posted March 7, 2019 Use this line to load json file and png file created from TexturePackagerGUI software. - this.load.atlas("sprites","sprites.png","sprites.json") And use below line to add sprites from created atlas (It adds ball.png from the atlas named "sprites") - var sprite = this.add.sprite(100,200,"sprites","ball3.png"); Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.