Generating Tiles [SOLVED]

So I’m in the process of creating the ‘world’ in my 2D Game and have just finished being able to render the floor tiles and when the player moves left/right new tiles are generated, however this means the tiles outside of the screen are still there and it’s creating very bad performance issues.

Is there a way to render the tiles only within the view able area of the screen, a point in the right direction would be great, I’m not looking for pages of code :stuck_out_tongue:

Thanks!

Im guessing that you render your tiles using a for loop to loop through each tile.

To make it render tiles in the view, make the loop on the x axis start at the cameras x poisiton, and make the loop on the y axis start at the cameras y position

I managed to make it work by only rendering tiles around the sprites location, works perfectly and the FPS shot right up. Thanks for your help anyway, your comment still helped me understand it better :wink: