Discuss Scratch

Kite_The_Skywing
Scratcher
2 posts

How do I change between costumes at random? - Please help!

Hello! Could I please have some help?

You see, I'm making a game, and I want to make a sprite change costumes at random, for example,
There's a chicken, she has multiple costumes, one with a tutu, one with a hardhat, one with a pair of boots and one with a scarf.
What I need to happen is you get to a certain background and when you enter it picks one of these costumes at random.
if you need me to explain more please ask.
I really need an answer as soon as possible!

Please help!

-Kite
mysterious-neutron
Scratcher
1000+ posts

How do I change between costumes at random? - Please help!

when backdrop switches to [the backdrop you want v]
switch costume to (pick random (1) to [the number of costumes you have]
PraCoco
Scratcher
1000+ posts

How do I change between costumes at random? - Please help!

Kite_The_Skywing wrote:

Hello! Could I please have some help?

You see, I'm making a game, and I want to make a sprite change costumes at random, for example,
There's a chicken, she has multiple costumes, one with a tutu, one with a hardhat, one with a pair of boots and one with a scarf.
What I need to happen is you get to a certain background and when you enter it picks one of these costumes at random.
if you need me to explain more please ask.
I really need an answer as soon as possible!

Please help!

-Kite
Hi! Here's the code you can follow:
when green flag clicked
repeat (10)
switch costume to [(pick random (1) to (the number of costumes you have)) v]
end

I made a project that switches costumes, so maybe you can look inside the project. Look for the code in the leaf sprite.
Here's the link: https://scratch.mit.edu/projects/450768240/
If you can explain more, I can help. Ask me if you need anything.
Hope it helps!
-TheGreenNinja-
Scratcher
100+ posts

How do I change between costumes at random? - Please help!

I think this is what you're looking for!

when green flag clicked
switch costume to (pick random (1) to (10))

Just change the 10 to however many costumes there are.
Hope this helps!

Edit: double ninja'd, darn it

Last edited by -TheGreenNinja- (Nov. 18, 2020 04:54:48)

Ankit_Anmol
Scratcher
500+ posts

How do I change between costumes at random? - Please help!

Kite_The_Skywing wrote:

Hello! Could I please have some help?

You see, I'm making a game, and I want to make a sprite change costumes at random, for example,
There's a chicken, she has multiple costumes, one with a tutu, one with a hardhat, one with a pair of boots and one with a scarf.
What I need to happen is you get to a certain background and when you enter it picks one of these costumes at random.
if you need me to explain more please ask.
I really need an answer as soon as possible!

Please help!

-Kite
Put pick random block in the switch costume
Kite_The_Skywing
Scratcher
2 posts

How do I change between costumes at random? - Please help!

Thank you so much for your help!
This will help me a lot! I really didn't expect the four of you to just hop in and help as quickly as you did, but I'm so glad you did!
Thank you to @mysterious-neutron, @PraCoco, @-TheGreenNinja- and @Ankit_Anmol



-Kite (Kite_the_Skywing)
PraCoco
Scratcher
1000+ posts

How do I change between costumes at random? - Please help!

Kite_The_Skywing wrote:

Thank you so much for your help!
This will help me a lot! I really didn't expect the four of you to just hop in and help as quickly as you did, but I'm so glad you did!
Thank you to @mysterious-neutron, @PraCoco, @-TheGreenNinja- and @Ankit_Anmol



-Kite (Kite_the_Skywing)
Anytime!
Super_Scratch_Bros20
Scratcher
1000+ posts

How do I change between costumes at random? - Please help!

Wouldn't this better be fit in Help with Scripts? Or should it just get closed since it's answered anyway?

Powered by DjangoBB