Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to reduce lag in my project?
- BlueBionicWhale
-
61 posts
How to reduce lag in my project?
Link to project: https://scratch.mit.edu/projects/544717742/
This project is very laggy, for example some of the frames repeat. And you have to press up and down multiple times just to switch between the two buttons, and sometimes it doesn't work. Are there any tips to fix or reduce the lag?
This project is very laggy, for example some of the frames repeat. And you have to press up and down multiple times just to switch between the two buttons, and sometimes it doesn't work. Are there any tips to fix or reduce the lag?
- BatteRaquette58
-
100+ posts
How to reduce lag in my project?
You can force them to go on turbowarp, a website which reduces lag by compiling projects in JavaScript.
Put this code in a new sprite with a costume that tells them to go on turbowarp.
Put this code in a new sprite with a costume that tells them to go on turbowarp.
Hope this helped!
Last edited by BatteRaquette58 (June 16, 2021 17:08:19)
- BlueBionicWhale
-
61 posts
How to reduce lag in my project?
You can force them to go on turbowarp, a website which reduces lag by compiling projects in JavaScript.
Put this code in a new sprite with a costume that tells them to go on turbowarp.Hope this helped!
My project is still pretty laggy, but I appreciate the help, thank you!
- Yusei-Fudo
-
1000+ posts
How to reduce lag in my project?
You can force them to go on turbowarp, a website which reduces lag by compiling projects in JavaScript.
Put this code in a new sprite with a costume that tells them to go on turbowarp.Hope this helped!
My project is still pretty laggy, but I appreciate the help, thank you!
It might have a little bit to do with your project, but most of the time, it's the computer that isn't running fast enough. It runs pretty fast for me.
Also, the block for sensing TurboWarp is this!:

Last edited by Yusei-Fudo (June 16, 2021 19:04:54)
- BlueBionicWhale
-
61 posts
How to reduce lag in my project?
You can force them to go on turbowarp, a website which reduces lag by compiling projects in JavaScript.
Put this code in a new sprite with a costume that tells them to go on turbowarp.Hope this helped!
My project is still pretty laggy, but I appreciate the help, thank you!
It might have a little bit to do with your project, but most of the time, it's the computer that isn't running fast enough. It runs pretty fast for me.
Also, the block for sensing TurboWarp is this!:
Oh I see, thank you! It might actually be my computer since it's not that powerful compared to most computers.
- Yusei-Fudo
-
1000+ posts
How to reduce lag in my project?
You can force them to go on turbowarp, a website which reduces lag by compiling projects in JavaScript.
Put this code in a new sprite with a costume that tells them to go on turbowarp.Hope this helped!
My project is still pretty laggy, but I appreciate the help, thank you!
It might have a little bit to do with your project, but most of the time, it's the computer that isn't running fast enough. It runs pretty fast for me.
Also, the block for sensing TurboWarp is this!:
- snip -
Oh I see, thank you! It might actually be my computer since it's not that powerful compared to most computers.
No problem!
- M_M_J_
-
32 posts
How to reduce lag in my project?
Griffpatch once said keeping the first sprite blank reduces the lag in game. (It was written in his project's comment) So maybe paint a new sprite and keep it first in the order. (I don't know if that will work, I have never tried it myself.)
- Awyzza
-
50 posts
How to reduce lag in my project?
In your continue button code you have a forever loop which:
1. Runs an animation of 10 frames with 0.1 seconds each. i.e. a 1 second animation
2. Checks if the arrow key is being pressed.
3. Repeats from 1 as soon as the next screen refresh hits.
If you press the up or down arrow, your odds of the script actually checking that are 1 in 30 because the rest of the time it is waiting for the next animation frame.
That is why your buttons don't seem to work unless you spam the arrow keys.
1. Runs an animation of 10 frames with 0.1 seconds each. i.e. a 1 second animation
2. Checks if the arrow key is being pressed.
3. Repeats from 1 as soon as the next screen refresh hits.
If you press the up or down arrow, your odds of the script actually checking that are 1 in 30 because the rest of the time it is waiting for the next animation frame.
That is why your buttons don't seem to work unless you spam the arrow keys.
- BlueBionicWhale
-
61 posts
How to reduce lag in my project?
Griffpatch once said keeping the first sprite blank reduces the lag in game. (It was written in his project's comment) So maybe paint a new sprite and keep it first in the order. (I don't know if that will work, I have never tried it myself.)
Ok, I'll try that, thank you!
- BlueBionicWhale
-
61 posts
How to reduce lag in my project?
In your continue button code you have a forever loop which:
1. Runs an animation of 10 frames with 0.1 seconds each. i.e. a 1 second animation
2. Checks if the arrow key is being pressed.
3. Repeats from 1 as soon as the next screen refresh hits.
If you press the up or down arrow, your odds of the script actually checking that are 1 in 30 because the rest of the time it is waiting for the next animation frame.
That is why your buttons don't seem to work unless you spam the arrow keys.
Oh Ok, so I guess if I get rid of the forever block the buttons will work better. Thank you for the help!
- Awyzza
-
50 posts
How to reduce lag in my project?
Er no, just move the animations into their own loops so the key press checks don't have to wait for them.In your continue button code you have a forever loop which:
1. Runs an animation of 10 frames with 0.1 seconds each. i.e. a 1 second animation
2. Checks if the arrow key is being pressed.
3. Repeats from 1 as soon as the next screen refresh hits.
If you press the up or down arrow, your odds of the script actually checking that are 1 in 30 because the rest of the time it is waiting for the next animation frame.
That is why your buttons don't seem to work unless you spam the arrow keys.
Oh Ok, so I guess if I get rid of the forever block the buttons will work better. Thank you for the help!
The other thing is which is a little strange is the use of Broadcast and then wait. I don't see immediate problems that arise from it but I also don't see why they've been used instead of simply Broadcast.
Last edited by Awyzza (June 17, 2021 06:15:20)
- -Navaneet1234-
-
31 posts
How to reduce lag in my project?
https://scratch.mit.edu/projects/544717742/Make A Sprite Called “ ” Without Any Scripts And Your Done Link to project:
This project is very laggy, for example some of the frames repeat. And you have to press up and down multiple times just to switch between the two buttons, and sometimes it doesn't work. Are there any tips to fix or reduce the lag?
- REMIX_EVERYTHING143
-
1 post
How to reduce lag in my project?
You can force them to go on turbowarp, a website which reduces lag by compiling projects in JavaScript.
Put this code in a new sprite with a costume that tells them to go on turbowarp.Hope this helped!
My project is still pretty laggy, but I appreciate the help, thank you!
- Discussion Forums
- » Help with Scripts
-
» How to reduce lag in my project?