anonrab Posted April 15, 2015 Share Posted April 15, 2015 I making game with pretty large unique levels (10000x10000 pixels) with unique picture at background. If i just load that image, it consume around of 500Mb of memory and work very slow. I can split this big image, to plenty of small images, but i have no idea, how to show them only when player see them, and destroy, when user do not see them.Thanks. Link to comment Share on other sites More sharing options...
drhayes Posted April 15, 2015 Share Posted April 15, 2015 Why not do exactly that? Split your image into a bunch of tiles, name them something like "image#x#.png" (where # is the x or y coordinate of the tile), and then convert the camera's view into an intersection of those tiles. At worse case you'll be showing four of the tiles when near the tile boundaries. You probably want to look at this camera property to figure out where you are in the world. You could use the JS modulo operator to help. Make sense? MichaelD 1 Link to comment Share on other sites More sharing options...
Recommended Posts