Discuss Scratch

dwemie
Scratcher
63 posts

Having trouble making a Walk Cycle

I've been having a lot of trouble with a walk cycle script, where the costume switch depending on which direction you walk. Could someone please help me? Thanks if you can

Last edited by dwemie (Feb. 13, 2023 14:38:37)

MarvelBooster
Scratcher
14 posts

Having trouble making a Walk Cycle

So your walk cycle script should look like this:

when green flag clicked
switch costume to [Idle1]
forever
if <key [d] pressed?> then
switch costume to [walkinganimation1]
move (10) steps
end


end
dwemie
Scratcher
63 posts

Having trouble making a Walk Cycle

MarvelBooster wrote:

So your walk cycle script should look like this:

when green flag clicked
switch costume to [Idle1]
forever
if <key [d] pressed?> then
switch costume to [walkinganimation1]
move (10) steps
end


end
I want the script to cycle through multiple costumes, not just one
DeveloperTools
Scratcher
100+ posts

Having trouble making a Walk Cycle

dwemie wrote:

I want the script to cycle through multiple costumes, not just one
Place this block under your “Green flag clicked” hat block:
set rotation style [left-right v]
Then, just make the player face 90 degrees when walking right, and -90 degrees when walking left

for cycling between costumes, use this:
(assuming the costumes are named like this: walk0, walk1, etc. and that there's 12 frames)
'
change [frame v] by (1)
switch costume to (join [walk] (((frame) mod (12)) + [1]))

Last edited by DeveloperTools (Feb. 13, 2023 15:44:07)

dwemie
Scratcher
63 posts

Having trouble making a Walk Cycle

DeveloperTools wrote:

dwemie wrote:

I want the script to cycle through multiple costumes, not just one
Place this block under your “Green flag clicked” hat block:
set rotation style [left-right v]
Then, just make the player face 90 degrees when walking right, and -90 degrees when walking left

for cycling between costumes, use this:
(assuming the costumes are named like this: walk0, walk1, etc. and that there's 12 frames)
'
change [frame v] by (1)
switch costume to (join [walk] (((frame) mod (12)) + [1]))
Thank you, that helps

Powered by DjangoBB