Seemingly random lag issue

I’m making a simple platformer, but as soon as I place around 30-40 tiles the FPS drops from a solid 60 to 30.

Screenshots of game + code


I’m making another game with higher quality textures, and that doesn’t lag at all even with tons more tiles + physics enabled, not to mention that game is much more complicated.

Side note: disabling the keyboard controls doesn’t fix the issue, nor does removing the FPS counter.

I have no idea how/why it’s doing this.

(Edit: formatting)

That’s weird, I have a game with similar graphics… Pixel Adventure(graphics name), I think… and works perfectly fine for me. Not to be rude or anything, but it might have something to do with your Computer. I think you should check whether it works on different devices too. Also, you might want to publish it and see if it works there, instead of previewing it(if you are doing so).

Also, I’m not sure, but this might help: Game lags when recording screen or game window - #3 by barbilou. But I dont think the memory part will apply to you because you’re not recording, but you can check anyway.