Kokos Posted June 18, 2015 Share Posted June 18, 2015 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? Link to comment Share on other sites More sharing options...
rich Posted June 20, 2015 Share Posted June 20, 2015 There is no image to get though, so Phaser can't return you an image in this instance. The image is the atlas with a bit of frame data depicting the area of the image to use. Link to comment Share on other sites More sharing options...
Kokos Posted June 22, 2015 Author Share Posted June 22, 2015 Makes sense I guess, there is no getSprite either for cache since it works on the source assets. I just realised I can just do new Phaser.Image(), which does the trick and makes the most sense. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts