Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Need help with random appearance at fixed x,y coordinates
- WhenwillEaglesWin
-
2 posts
Need help with random appearance at fixed x,y coordinates
Help! I've looked at a number of responses to questions similar to mine but they just don't seem to fit the bill (or I'm just not understanding it enough…which is more likely the case). I have a bunch of fixed x,y coordinates and I want my sprite to appear at one of those every second or so, randomly (very similar to Whack-a-Mole in that respect). I've seen responses about creating two lists, one for the X coordinates and one for the Y but I just don't understand how that would work when it must go to a fixed X and Y coordinate. How do you input a list? My script for that part starts off:
Set Location to Pick Random 1 to 14
go to x: item Location of x and Y Coordinate List Y: item Location of x and Y Coordinate List
I'd say I'm lost after that but I think I'm lost before that
Any help would be appreciated. Thank you.
Brian
Set Location to Pick Random 1 to 14
go to x: item Location of x and Y Coordinate List Y: item Location of x and Y Coordinate List
I'd say I'm lost after that but I think I'm lost before that

Any help would be appreciated. Thank you.
Brian
- maverick_raven12
-
100+ posts
Need help with random appearance at fixed x,y coordinates
so your script is
right?
Last edited by maverick_raven12 (March 1, 2016 00:47:55)
- peppermintpatty5
-
1000+ posts
Need help with random appearance at fixed x,y coordinates
You need to make two lists:

Edit: minor fix to the previous script I had.
Then, fill the lists with your ordered pairs. Now, you can use these blocks:
Hope this helps!

Edit: minor fix to the previous script I had.
Last edited by peppermintpatty5 (March 1, 2016 01:36:33)
- maverick_raven12
-
100+ posts
Need help with random appearance at fixed x,y coordinates
well, maybe you could just make a sprite so tiny you cant see it for each coordinate, so your script could be
- LLCoolJC
-
70 posts
Need help with random appearance at fixed x,y coordinates
You can randomise is at a small scale and then position in at a large one.
- WhenwillEaglesWin
-
2 posts
Need help with random appearance at fixed x,y coordinates
Thank you for the feedback. I will try them to see which one works best for my scenario. Thanks again.
- Discussion Forums
- » Help with Scripts
-
» Need help with random appearance at fixed x,y coordinates