Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How do I make a sprite change costume almost each time it moves when it has more than one costume?
- WTayler
-
3 posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
So my sprite has multiple costumes for when it's running and for some reason I can't pin down how to make it move while switching through the costumes every time I press either right arrow key, or left arrow key.
So far here is my program for define_run:
So far here is my program for define_run:
define run
if <(char:move) = [1]> then
point towards [sensor_right v]
switch costume to <(costume #) = [15]>
repeat until <not <key [right arrow v] pressed?>>
if <(costume #) = [28]> then
switch costume to <(costume #) = [15]>
wait (0.1) secs
else
if <(costume #) < [14]> then
switch costume to <(costume #) = [15]>
else
switch costume to ((costume #) + [1])
change x by [5]
wait (0.1) secs
end
end
else
end
- georgeskey
-
100+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
The booleans essentially only report true or false (other then the last one, which changes the costume num by 1; it's a reporter, not a boolean) so you're essentially saying “switch costume to true” or “switch costume to false”…
- WTayler
-
3 posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
But earlier one when I used the same script, it switch the costume by it's currently set costume by 1. I want it to do that but move as well in an orderly fashion. Something like if all the booleans are false, then its repeatedly activates this until one of these are true.
- deck26
-
1000+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
The booleans are fine in the if blocks but you don't want them in the switch costume blocks. But earlier one when I used the same script, it switch the costume by it's currently set costume by 1. I want it to do that but move as well in an orderly fashion. Something like if all the booleans are false, then its repeatedly activates this until one of these are true.
- WTayler
-
3 posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
Well thank you both for fixing my error, but it still doesn't move.

- mstone326
-
1000+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
Can you share your project so we can see if there are any other scripts that are conflicting. It makes it much easier than just guessing at what the issue is.
- crisostimo
-
500+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
I put this in a Scratch beginners tutorial. You can see the project here:
https://scratch.mit.edu/projects/121209255/
Then in the notes it has a bunch of youtube videos where I explain how it works if you are interested.
In your case you would follow the example of starting the walking animation using a broadcast like in my project, but then stop the animation when the key was no longer pressed.
https://scratch.mit.edu/projects/121209255/
Then in the notes it has a bunch of youtube videos where I explain how it works if you are interested.
In your case you would follow the example of starting the walking animation using a broadcast like in my project, but then stop the animation when the key was no longer pressed.
- tigerstar-
-
1 post
How do I make a sprite change costume almost each time it moves when it has more than one costume?
UMMM HELP ME
- xMystic416
-
100+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
Hi! Next time, please don't necropost. This is an old topic. If you need help, make your own one. Thanks! UMMM HELP ME
- itsmesupermicrowave
-
1 post
How do I make a sprite change costume almost each time it moves when it has more than one costume?
i want this
when this sprite clicked
if <> then
switch costume to [ 2]
else
switch costume to [ 3]end
- DerpyHead0
-
1000+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
please don't necropost, this thread is 2 years old. if you want help with something create a new thread i want thiswhen this sprite clicked
if <> then
switch costume to [ 2]
else
switch costume to [ 3]end
- imAFK
-
12 posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
when green follow clicked
say [thanks] for (2) secs
- Merry_Kitten1212
-
2 posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
when green flag clicked
go to x: (?) y: (?)
repeat (?)
wait (?) secs
next costume
end
- The_Imaginarium
-
1000+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
Please refrain from necroposting on old topics.when green flag clicked
go to x: (?) y: (?)
repeat (?)
wait (?) secs
next costume
end
https://scratch.mit.edu/discuss/topic/355062/
Last edited by The_Imaginarium (May 8, 2021 20:04:35)
- han614698
-
1000+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?

- Harakou
-
1000+ posts
How do I make a sprite change costume almost each time it moves when it has more than one costume?
Hi! Thank you for offering your help, but this thread is pretty old - I don't think it's relevant anymore. When you respond to a topic, please make sure it's recent and the original poster still needs an answer. Thanks!when green flag clicked
go to x: (?) y: (?)
repeat (?)
wait (?) secs
next costume
end
- Discussion Forums
- » Help with Scripts
-
» How do I make a sprite change costume almost each time it moves when it has more than one costume?