Picking random sprite out of a group of the same sprites

Trying to move sprite1 to a random sprite2 but there is more than one sprite2s.

You can use arrays. Just set the posistion to the position of a random sprite in an array of sprite2 types.

@plierplierplier you might want to use an array:

  1. Go to Advanced
  2. Select Arrays.
  3. Create a number array
  4. Go to Images and take out an image (|_|) block.
  5. Drag it into the array. Repeat for each array selection.
  6. Put it into On Start
  7. Put a On game update every __ ms then and drag a set mySprite image to Get random value from myArray. Here is an example
    image
    image

Assemble the “sprite2” sprites into one big list, then you can use the “get random value from” to pick a random sprite2 from that array, get their x and y, and set sprite1 x and y to random sprite2’s x and y.