Jump to content

Working with Texture Atlas and Phaser 3


Recommended Posts

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.







Link to comment
Share on other sites

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");

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.

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