How do I get Sprites to switch places when the Green Flag is pressedso they go to a random place? Need it for a Deal Or No Deal game with boxes that change places.
Offline
when green flag
goto 50*(random from 1 to 7 - 3) , 50*random from 1 to 3
Offline
The hard part would be making sure only one box ended up in one place.
Offline
Ah, sorry. I hadn't realized it was a permutation question. That is a bit harder in scratch, since there are no arrays. If there are small number of sprites, you could have them find places one a time:
sprite 1 :
On green flag
go to random box
broadcast place2
sprite2:
when I receive place2
goto random box
repeat until not touching color (color on all sprites)
goto random box
broadcast place3
(all the subsequent sprites are like sprite2, but with the numbers incremented by one)
The "goto random box" should be replaced by the appropriate goto command.
Offline
put this in all the the sprites you want to scramble.....[blocks]<when green flag clicked>(<forever><wait( 3 )secsc><go to x <pick random( -200 )to( 200)y
<pick random( -200 )to( 200)[/blocks]
hope that helps
Offline