Kokos

Get sprite from cache with textureatlases

Recommended Posts

I just started implementing textureatlases into my project, which is working perfectly for the most part.

However, in some places in my project I use game.cache.getImage, which doesn't work anymore.

 

An old game.add.sprite(x,y,key) has simply turned into game.add.sprite(x,y,atlas,key), but there is no game.cache.getImage(atlas,key).

 

I need to get the image from cache because I use it as a mask, and it doesn't need to be added to the game.

 

I fixed my problem now by simply using game.add.image, and then destroying the image after using it, but that is not an optimal solution.

 

Is there a way to get this to work?

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.