Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » leg movement
- sky-fly
-
2 posts
leg movement
In scratch I can make a sprite move but I can't get the legs to move! My sprite just glides!
can someone help me!!!!!!
can someone help me!!!!!!

- mwiedmann
-
100+ posts
leg movement
Sprites won't animate themselves. If you want a sprite to animate like it is walking or something, you have to draw multiple costumes for it and then use the “next costume” block in your code.
The standard Cat sprite has 2 frames that you can experiment with:
When GF Clicked
forever
move 2
next costume
wait .2
This will make it look like he is walking across the screen.
- drmcw
-
1000+ posts
leg movement
You need to change the costume. If you use the scratch cat then it should have two costumes that look like the legs are moving when you put a next costume inside a forever block. You'll also need to add a wait statement to slow things down, unless you're going for the roadrunner look! If you then add a move statement to the next costume then the sprite should move and look like the legs are moving too.
- mwiedmann
-
100+ posts
leg movement
Here is an example that uses a timer to decide when to change the costume. It gives you a smoother animation. It also has the Cat holding some different weapons, so it demos a few different things.
Timer based animation
- AwesomeMarioBros
-
97 posts
leg movement
That's gonna be hard, but first draw the leg movements, and then follow this script. In scratch I can make a sprite move but I can't get the legs to move! My sprite just glides!
can someone help me!!!!!!
- Locomule
-
1000+ posts
leg movement
Instead of a timer, I use a variable that counts up by 1 but only when the sprite moves. Once it gets above a certain number, the sprite switches to the next costume and the variable resets to 1. The benefit of this technique is that your costume changes according to how much the sprite moves, which can be more realistic than using a timer. Really it depends on how complex your game is.
Adjusting the amount the variable resets at will speed up or slow down how fast the sprite appears to walk.
Adjusting the amount the variable resets at will speed up or slow down how fast the sprite appears to walk.
Last edited by Locomule (Nov. 27, 2014 23:34:26)
- Locomule
-
1000+ posts
leg movement
Your post reminded me of an old project I made but never shared till now. This may or may not seem a little advanced but the theory is great to know for anyone drawing their sprites, something I highly recommend when feasible.
Coincidentally, I used wait blocks here to make the costumes change at the correct speed. Since there is nothing else going on in this project, that works fine. But in a big, complex game which will have varying amounts of things happening at any given moment the player is walking around, I'd go with the method I mentioned in my previous post.
Coincidentally, I used wait blocks here to make the costumes change at the correct speed. Since there is nothing else going on in this project, that works fine. But in a big, complex game which will have varying amounts of things happening at any given moment the player is walking around, I'd go with the method I mentioned in my previous post.
Last edited by Locomule (Nov. 27, 2014 23:32:06)
- danielperez
-
22 posts
leg movement
Well first you have to animate your sprite, so you will have costumes to replace.
Then go to the scripts and try using that code:
Then go to the scripts and try using that code:
- Kitsune-chan543
-
3 posts
leg movement
But what if you have multiple costumes for one sprite? Like, ones that aren't for walking, like equipping an item. Also, my sprite won't turn around when i tell it to turn 90 degrees left instead of right.
- IronBit_Studios
-
1000+ posts
leg movement
Please don't necropost. I suggest using the But what if you have multiple costumes for one sprite? Like, ones that aren't for walking, like equipping an item. Also, my sprite won't turn around when i tell it to turn 90 degrees left instead of right.
block.
- Abdullah992015
-
1 post
leg movement
Here is one way! Possibly the Best Way Ever! 

Last edited by Abdullah992015 (Aug. 13, 2015 07:38:20)
- joshuaho
-
1000+ posts
leg movement
*Ahem* Hey folks, its great that you want to help out! However, this topic is rather old and I don't think the topic owner is watching it anymore. Please check the date of the posts before posting and don't bump up old threads that have been resolved. Thanks! 

- Discussion Forums
- » Help with Scripts
-
» leg movement