Reputation: 47
I am making a game and I have hidden treasures on a grid that randomly assign new positions each game. The treasure chest sprites can go in any square on the grid, but need to be in the middle (ie cannot be crossing two boxes). How can I do this? I know how to make a sprite move to a random place, but not a random selection of pre-set places.
Upvotes: 1
Views: 2255
Reputation: 1
Try using a pick random number block (in operators) and type the preset coordinates in. It will pick a random one of them. This only works if they are consecutive numbers.
Upvotes: 0
Reputation: 33399
You can create 2 lists of coordinates, one for x and one for y. Then you can pick a random spot in the list and go there:
Upvotes: 1