How to 2D Render distance, (low fps)

I created a game that generates a land, similar to Minecraft 2D, but the problem is that it crashes a lot because it has a lot of blocks/ objects

I want to know how to make the blocks that are not in the camera view disappear, and show the blocks that are in the camera view

I tried using the hide and show action but it doesn’t work, the fps is still low

My understanding is that objects off screen isn’t rendered. It could be your events that are affecting it. Can you provide screen snips of any events that involve the block objects?

As the terrain is generated, the FPS decreasess

That terrain is being generated every single game frame - around 60 times per second. There are no conditions to stop it, so it’s continuously creating blocks.

Instead, you should look at generating the blocks as needed once you have a few screen full. Here’s an example of that, but only for filling in the right side as the camera moves right:

2 Likes