SpaceCowboy2071 Posted March 14, 2017 Share Posted March 14, 2017 Hi, I'm creating my first project with Phaser. I have two large background TileSprites that I want to toggle between as the game is played. When the game state calls the create() method it creates the sprites and then sets one visible true and the other false. After a set time, it will swap. The first time this swap is called, there's a bit of lag. Subsequent swaps have no lag. I've experiencing this on my Nexus 5X and Laptop (Core i7 + GTX960M). I'm guessing that because I almost immediately set visible to false, the second sprite isn't being rendered to the GPU. Once it has rendered at least one time, then subsequent calls to toggle the visibility don't lag cause the texture is somehow cached. This is all conjecture on my part, I really don't know how these things work. Is there anyway to cache a sprite/texture to the GPU, so that toggling the visibility won't cause lag? Thanks! Link to comment Share on other sites More sharing options...
squilibob Posted March 18, 2017 Share Posted March 18, 2017 Instead of using visibility you could put both tile sprites into a group. When you wanted to toggle between them call Group.bringToTop Link to comment Share on other sites More sharing options...
Recommended Posts