Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » how do i make sprites walk smoothly and not lagged
- Duel_
-
New Scratcher
2 posts
how do i make sprites walk smoothly and not lagged
am making a adventure game and my sprites wont walk smoothly
- mstone326
-
Scratcher
1000+ posts
how do i make sprites walk smoothly and not lagged
Can you share your project. Go to your project, click share and then post the link in here. It will help us to better help you when we see what we're working with and where you are within your scripts.
- WolfCat67
-
Scratcher
1000+ posts
how do i make sprites walk smoothly and not lagged
when green flag clicked
forever
if <key [right arrow v] pressed?> then
change x by (5)
else
if <key [left arrow v] pressed?> then
change x by (-5)
end
end
- learncsscratch
-
Scratcher
100+ posts
how do i make sprites walk smoothly and not lagged
“Smoothly” is a subjective measurement…movies for example are filmed in 24 frames per second…most video gamers complain if they have less than 30 frames per second and high end systems seek 60 - 120 frames per second…
Keep in mind you may have to turn on turbo mode to achieve the smoothest movement…However, here are a few things you can try to see if it makes things smooth enough for you…
These are some general guidelines. If you have a specific problem with a script, post a link here and we can try to help you smooth things out in your actual program…
Good Luck…Happy Scratching!!!
Keep in mind you may have to turn on turbo mode to achieve the smoothest movement…However, here are a few things you can try to see if it makes things smooth enough for you…
- While you may need to add a
wait () secs
block in your animation script to keep butterflies from flapping their wings like humming birds, you will want to separate yourmove () steps
to a different script starting with its ownwhen gf clicked
block. By separating them, you can remove the animation delay from the movement code. - Minimize the amount of code that is running in your movement script. It is OK to have several different “threads” running because you have multiple green flags… You just need to make sure that these separate scripts are not competing in a “race condition”…For example, two different scripts are waiting until something is touched and then they hide the sprite. But when the first script “hides” the sprite, the second script can no longer touch anything because it is hidden.
- Moving several small steps looks smoother than moving large step amounts.
- The glide block creates smooth motion, but program flow does not continue below that block until the block is finished. Again, separate this script from other scripts to keep everything running smoothly…
These are some general guidelines. If you have a specific problem with a script, post a link here and we can try to help you smooth things out in your actual program…
Good Luck…Happy Scratching!!!
- Bentton
-
Scratcher
53 posts
how do i make sprites walk smoothly and not lagged
If you want to create a walk animation, I would use the scratch cat sprite because it has a standing, and a walking costume which is perfect for beginners! If you want to get the scratch cat sprite, It will be there whenever you start a new project.
Once you have the sprite, put this script for it:
Hope that helps!!!
Once you have the sprite, put this script for it:
when green flag clickedPress the green flag to restart it.
go to x: (-100) y: (0)
point in direction (90)
repeat until <(x position) > [99]>
next costume
change x by (10)
wait (.1) secs
end
Hope that helps!!!

- Discussion Forums
- » Help with Scripts
-
» how do i make sprites walk smoothly and not lagged




