Can somebody please review my code and tell me how to fix this sudden lag spike whenever the code goes through an if statement, it’s been an hour and i haven’t been able to figure it out.
1 Like
Hello and welcome to the Makecode Forum! It looks like the Story extension uses the pause function to pause blocks of code, so that the next block doesn’t run until the current one stops.
This works well for stories, which are long strings of story blocks one after another, but when you use a pause inside certain blocks, it freezes your whole game until the pause ends! The “update sprite every…” block you are using is one of these freezing blocks. Instead, since you only have one sprite, you can put the code into a Forever block, like this:
Forever blocks don’t freeze up when the code pauses, so it should work well for what you are doing!
1 Like
It worked thank you very much you have taken a huge problem of my back, again thank you.
1 Like