Discuss Scratch

BossGamer2004
Scratcher
8 posts

Walking + Animation?

Hey, I'm kinda new here, and I know how to make the sprite walk using the arrow keys and I know how to make the sprite change costume for animation. I just don't know how to get the sprite to move with the animation and how it stop when the arrow key isn't being pressed. My last attempt had the sprite move right but constantly shift through the walk animation forever. My Scratch game is supposed to be a fighting game and the character isn't supposed to be able to move all over the screen. They're only supposed to move right and left. Anybody have any tips?
Tookiekat_studios
Scratcher
38 posts

Walking + Animation?

here is how you would do that.

make a script for walking, for example:
whenSpacekeypressedmove10stepspointtowardsMouse-pointer

then for you're walking animation, you would make another script with the if key pressed using the same key as your movement key. like this

whenSpacekeypressedifkeySpacepressed?thenforevernextcostumewait0.09secselsestopThis script

if this dosent work, please let me know!
mstone326
Scratcher
1000+ posts

Walking + Animation?

Can you share your project? How many costumes are in each animation set? How many sets are there? (idle, walking, running, jumping, falling, punching, etc)

There are several ways to animate but will help if we can see how to implement it with your other scripts and with your costume sets.
TromboneAndSaxophone
Scratcher
91 posts

Walking + Animation?

Here's a platforming tutorial that includes animating sprites: https://scratch.mit.edu/projects/67727504/



Tookiekat_studios wrote:

whenSpacekeypressedifkeySpacepressed?thenforevernextcostumewait0.09secselsestopThis script

if this dosent work, please let me know!
This won't work. It will always change the costume once space is pressed.
BossGamer2004
Scratcher
8 posts

Walking + Animation?

TromboneAndSaxophone wrote:

Here's a platforming tutorial that includes animating sprites: https://scratch.mit.edu/projects/67727504/



Tookiekat_studios wrote:

whenSpacekeypressedifkeySpacepressed?thenforevernextcostumewait0.09secselsestopThis script

if this dosent work, please let me know!
This won't work. It will always change the costume once space is pressed.

Thank you so much, the tutorial worked for me! Thanks to everyone for the effort! Have a great day.
Erts57
Scratcher
23 posts

Walking + Animation?

whenclicked
foreverifkeydpressed?thenWalk6stepsThenPutThewalkAnimationInThedefine

Last edited by Erts57 (Aug. 6, 2019 15:03:11)

codeman1044
Scratcher
1000+ posts

Walking + Animation?

Please don't blockspam or necropost. This topic is over a year old.
megamonk
Scratcher
29 posts

Walking + Animation?

Tookiekat_studios wrote:

here is how you would do that.

make a script for walking, for example:
whenSpacekeypressedmove10stepspointtowardsMouse-pointer

then for you're walking animation, you would make another script with the if key pressed using the same key as your movement key. like this

whenSpacekeypressedifkeySpacepressed?thenforevernextcostumewait0.09secselsestopThis script

if this dosent work, please let me know!

thannk u
deck26
Scratcher
1000+ posts

Walking + Animation?

megamonk wrote:

Tookiekat_studios wrote:

here is how you would do that.

make a script for walking, for example:
whenSpacekeypressedmove10stepspointtowardsMouse-pointer

then for you're walking animation, you would make another script with the if key pressed using the same key as your movement key. like this

whenSpacekeypressedifkeySpacepressed?thenforevernextcostumewait0.09secselsestopThis script

if this dosent work, please let me know!

thannk u
No need to necropost to thank someone for an old post.
nerdboy0
Scratcher
2 posts

Walking + Animation?

The animation is not working the animation keeps on going.
nerdboy0
Scratcher
2 posts

Walking + Animation?

Please help!

Last edited by nerdboy0 (Dec. 7, 2019 00:06:36)

D0GG0THEepicDoge
Scratcher
1 post

Walking + Animation?

Same
Thatbrightstar
Scratcher
1 post

Walking + Animation?

this isn't workkiinnnng
Teddy_Bear3
Scratcher
42 posts

Walking + Animation?

Thatbrightstar wrote:

this isn't workkiinnnng
If you were talking about this:

Tookiekat_studios wrote:

here is how you would do that.

make a script for walking, for example:
whenSpacekeypressedmove10stepspointtowardsMouse-pointer

then for you're walking animation, you would make another script with the if key pressed using the same key as your movement key. like this

whenSpacekeypressedifkeySpacepressed?thenforevernextcostumewait0.09secselsestopThis script

if this doesn't work, please let me know!
Then it's because instead of:
forevernextcostumewait0.09secs
you need to do:
repeatuntilnotkeyspacepressed?nextcostume
timetotimetrave123
Scratcher
12 posts

Walking + Animation?

do this script
whenclickedswitchcostumeto costume 1forevernextcostumewait.05secsend
MCdonalds254
Scratcher
1 post

Walking + Animation?

whenclickeddeletebrainofbrain
Teenager_in_love
Scratcher
1 post

Walking + Animation?

Is there a way I do not have to use the “next costume” block? Like, if I wanted to add a walk cycle to both the -10 and 10 steps?
mstone326
Scratcher
1000+ posts

Walking + Animation?

Yes, but always best to start a new topic. This one is originally from 2018.

You can use a variable to control the speed of the animation. Here is a quick example. https://scratch.mit.edu/projects/383305591/
meeeeeeeep1
Scratcher
45 posts

Walking + Animation?

whenclickedsetrotationstyleLeft-Rightifkeyleft arrowpressed?thenpointtowards-90nextcostumeifkeyright arrowpressed?thenpointtowards90nextcostume
Silver_star_2008
Scratcher
5 posts

Walking + Animation?

Okay, if this is still in use, I have a question: When my walking animation is on for a game,and then I jump, the walking animation continues,and my jump animation doesn't show, why is this, also you can check it out.. I posted it, and it is called prototype, cuz I haven't finished it, but basically, my dog will walk, but when I walk and jump, it will jump, but the jump animations won't show. You should just look at it to under stand. Press the right arrow key and then up arrow key, and you'll see that the dog jumps, but the animations will not come up. If you jump without pressing the right arrow key, it processes and the jump animations happen, but it just stays in place. Oh and a FYI, the game is a scroller platformer game. Is that a reason it doesn't work? Someone help!!!

Powered by DjangoBB