Clone lag

like i've said in other posts, the vast vast vast majority of snap slowdown is the amount of blocks that have to run per frame. thousands of clones are no issue as long as they don't individually run scripts.

  • clones will keep the same local variables, position, size, costume, and any other sprite properties from when they were created. you can prevent a large lag spike and many potential mistakes by moving all that setup from the clone start to the loop where the clones get created.
  • sprites already don't render when they're offscreen, it only makes things slower to manually hide them.
  • instead of having every clone move individually, set them to anchor to the parent sprite and then move just that one sprite.
  • instead of having every tile check if the player is touching it to tell the player what kind of tile it's touching, the player can use "my neighbors" in sensing, "(variable) of (sprite)", and "ask" in control to pick out information from only the needed tiles.
  • instead of constantly checking if the "h" variable is below 0 in a loop, check it when you set it on the "when clicked" hat

that should get rid of all the code that runs for each clone and make the project far far faster, almost certainly the most important change you can make. other than that is just reducing the amount of blocks you use, including removing custom blocks.

stamping is also very slow unless you pull a lot of tricks, and even with all the tricks available i'm fairly certain it would still be much slower than clones for your project.

i'm close to finishing up these changes for you to look at and use so feel free to just wait a bit for a project link.

(my other very very detailed posts for reference)