Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to make Sprites Move Smoothly
- Lachiepower0402
-
7 posts
How to make Sprites Move Smoothly
Hi,
Could anyone please tell me how to make sprites smoothly, for example my project is a car and at the moment I have it set to
Change x by -10 to go left
Change x by 10 to go right
But when I do this the car moves in steps.
Could anyone please tell me how to make sprites smoothly, for example my project is a car and at the moment I have it set to
Change x by -10 to go left
Change x by 10 to go right
But when I do this the car moves in steps.
- zanzolo
-
66 posts
How to make Sprites Move Smoothly
One way would be something like this: It moves by one pixel at a time, and does it 10 times
- lifesalibrary4me
-
43 posts
How to make Sprites Move Smoothly
I just use the glide __ seconds to x:__ y:__, but that’s just because I do animations. If you are doing a game it would be harder.
- zanzolo
-
66 posts
How to make Sprites Move Smoothly
I just use the glide __ seconds to x:__ y:__, but that’s just because I do animations. If you are doing a game it would be harder.
Glides are great for somethings.
I don't like them for games though because once you start a glide you pretty much have to finish it.
- Lachiepower0402
-
7 posts
How to make Sprites Move Smoothly
The first post works quite well but it is too slow for what I am doing, is their any way to have the same thing but faster?
- AonymousGuy
-
1000+ posts
How to make Sprites Move Smoothly
Try the following: The first post works quite well but it is too slow for what I am doing, is their any way to have the same thing but faster?
The sprite will jump by 10 pixels each time, but it should look smooth because it is in a continuous loop.
The sprite can go faster or slower by changing the amounts.
- Lachiepower0402
-
7 posts
How to make Sprites Move Smoothly
Thanks that works perfectly, but I have another question. In this same game the car passes brick walls that are moving past the car, how can I make it so that when the car misses a brick wall their is a score that shows this?
- AonymousGuy
-
1000+ posts
How to make Sprites Move Smoothly
It depends on how the walls are moving. Is the car sprite staying in the center of the screen, with the wall sprites moving? If so, then you can do something like this:
Also, if this isn't the method your game is using, please say so, as I can give a more helpful script. It will probably be somewhat similar to this script anyways.
Variable explanation: If you don't yet know what a variable is, you can create one by going to the Data tab and clicking “Create Variable”, then naming it what you want (in this case, Score.) Variables are basically just values that can be rewritten and reused, so their value will be read and used instead of a manually input value. (If that makes sense.)
Also, if this isn't the method your game is using, please say so, as I can give a more helpful script. It will probably be somewhat similar to this script anyways.

- Lachiepower0402
-
7 posts
How to make Sprites Move Smoothly
No sorry that didn't work, the car sprite moves left and right along the screen and a wall comes down from the top of the screen to the bottom, hides, reappers at the top in a different spot and goes down again and the car has to avoid the wall otherwise a background comes up saying game over. So for every wall the car doesn't hit I want the score to go up by one. What happened just then was when I avoided a wall the score when up very quickly to a high number i.e. 17931724.
- AonymousGuy
-
1000+ posts
How to make Sprites Move Smoothly
Okay, so I think that means that the x position blocks just have to be changed to y position blocks: No sorry that didn't work, the car sprite moves left and right along the screen and a wall comes down from the top of the screen to the bottom, hides, reappers at the top in a different spot and goes down again and the car has to avoid the wall otherwise a background comes up saying game over. So for every wall the car doesn't hit I want the score to go up by one. What happened just then was when I avoided a wall the score when up very quickly to a high number i.e. 17931724.
- Lachiepower0402
-
7 posts
How to make Sprites Move Smoothly
That is a lot better, but the score doesn't just go up by 1, when the wall passes the car the scores goes up until the wall disappears, so the wall moves from the top goes down and passes the car as i avoid it and the score goes up when moving past the car and then the wall moves to the top again.
- AonymousGuy
-
1000+ posts
How to make Sprites Move Smoothly
Add the following after the block changing the score:
- AonymousGuy
-
1000+ posts
How to make Sprites Move Smoothly
You're welcome! That works, thank you.

- lederniersamourai
-
500+ posts
How to make Sprites Move Smoothly
glide can be interrupted any time: just put them under an “event hat” such as this one:I just use the glide __ seconds to x:__ y:__, but that’s just because I do animations. If you are doing a game it would be harder.
Glides are great for somethings.
I don't like them for games though because once you start a glide you pretty much have to finish it.
Just set variable to new values to glide on another path and schedule, and then use neutral values (i.e. 0 secs, current x value and current y value) for stopping gliding,
- REPUS
-
18 posts
How to make Sprites Move Smoothly
This script will make a sprite glide to a place ten steps over, instead of simply reappearing in a place ten steps over.
Last edited by REPUS (Nov. 11, 2014 02:52:04)
- Discussion Forums
- » Help with Scripts
-
» How to make Sprites Move Smoothly