Discuss Scratch

Blastyall8
Scratcher
42 posts

How to make a scratch project run smoother?

I am working on a game and every time I play it it is very laggy. I have tried a few things to make it less laggy but none of them have worked any tips?

Gift Rush
CoolCrafter1231
Scratcher
100+ posts

How to make a scratch project run smoother?

You could always use Turbowarp
https://turbowarp.org/

I could also check your code to see where you could optimize
CoolCrafter1231
Scratcher
100+ posts

How to make a scratch project run smoother?

So i found that the movement script is causing alot of lag. have it run once the player plays instead when the green flag is clicked

Also its because the script is testing for a color which is a lot less efficient then testing for a sprite. replacing the boolean that tests for color with one that tests for the ground will work way better.

Last edited by CoolCrafter1231 (Dec. 15, 2021 17:14:33)

awesome-llama
Scratcher
1000+ posts

How to make a scratch project run smoother?

Colour detection blocks are very slow in comparison to all the other scratch blocks. Using them a lot therefore results in a lot of lag. You happen to be using two in the player sprite. If your speed is high, the custom block will attempt to repeat many times, and by many times, it could be thousands in a single frame (1/30 sec).
I highly recommend showing the speed variables on the screen. When debugging, you'll often want to look at what variables are doing. If you do so, you'll easily notice that the lag gets more noticeable as the speed y variable changes, and you'll also notice that the speed is being changed at the wrong time.
CoolCrafter1231
Scratcher
100+ posts

How to make a scratch project run smoother?

Here's a link to the optimized version i made

https://scratch.mit.edu/projects/617458732/
carmboy
Scratcher
14 posts

How to make a scratch project run smoother?

You can use turbo mode. it actually makes your project faster.



Using fewer scripts at a single time.
Avoid the use of cloning.
Using more vector graphics in projects.
Simplify the scripts as much as possible.
Limiting the number of objects to be visible at a time.
Using the run option without the screen fresh, if possible.

Powered by DjangoBB