I want to know how I can make a sprite appear by clicking a button in a random fashion.
Let's say I have ten sprites all in hide stage and a "Show Sprite" button. By clicking the Show Sprite button, I would like a randomly selected sprite to show up. Broadcast does not seem to work since it does not allow randomization.
Any help will be appreciated.
thanks.
Offline
Here's something you could use:
Put this in the button sprite:
when gf clicked set [show v] to (0) forever if <(mouse down?) and (touching [mouse pointer v]?)> set [show v] to (pick random (1) to (10))//This randomizes what shows. endAnd use this in the 10 randomly showing sprites:
when gf clicked forever if <(show) = (1)>//1 for the first sprite, 2 for the second, ect... show else hide endI hope that this helps!
Last edited by ErnieParke (2012-10-28 21:18:15)
Offline
zammer990 wrote:
when gf clicked broadcast (pick random (1) to (x))//just drag a random into the dropdown when I receive [1 v] script
Thank you for your help.
Using a simple number in broadcast makes sense.
Offline