Discuss Scratch

AH5044
Scratcher
22 posts

Where to put the 'pick random' block

I am making a project where there is something spinning and it has to choose one of the four things on the wheel. I have the code so it can pick it (a:
(pick random (1) to (10))
) but what do I put it in??

Any answer would be appreciated.
Vaibhs11
Scratcher
1000+ posts

Where to put the 'pick random' block

Please share the project and link it.
rgantzos
Scratcher
100+ posts

Where to put the 'pick random' block

What you want to do is on start set velocity to pick random 20 to 30, then repeat until velocity is less than 1, change velocity by -0.5 and rotate velocity degrees. This will end up with it pointing in a random direction.

You can also do on start point in direction pick random 1 to 4 times 90
helloworldbyeworld
Scratcher
1000+ posts

Where to put the 'pick random' block

You can just use this script:

define spin (items on wheel)
point in direction ((pick random (0) to ((items on wheel) - (1))) * ((360) / (items on wheel)))
AH5044
Scratcher
22 posts

Where to put the 'pick random' block

Vaibhs11 wrote:

Please share the project and link it.
https://scratch.mit.edu/projects/546948239
Thingied
Scratcher
1000+ posts

Where to put the 'pick random' block

Here's what I did:

Previously there would be a new random number every time the pick random () to () block was used but now it's only used once. I did this by setting a variable to a random number and broadcasting something based off of the result.

Powered by DjangoBB