How do I create random sprites?

I have made 10 different enemy sprites. I want to spawn them randomly from the top of the screen from 4 fixed positions (I made 4 boxes on the top of the screen to spawn them). However I can only spawn 1 type of enemy from one box. I watched tutorial on youtube by RapaGamez but it shows me how to spawn one enemy object on random position and color (but it is one type of enemy).So my questions are (if it is possible):

  1. How to spawn 10 different types of enemy randomly from one box?
  2. If I set timer that every 2 seconds one of the four boxes will spawn an enemy, How can I make it randomly spawn enemies between the four boxes?
    I know it is too much. But I really need help. Thank you so much in advanced.

Hi! I think I can help!

Before anything - I advise you read the Documentation for help with this stuff, instead of watching Youtube tutorials. ^^ The documentation can be very helpful and covers a lot more than video tutorials are usually able to do, so it’s good to do that! It’s just my personal opinion though, no worries!

There are quite a few ways to do that. One of these ways would be to set a random number to a variable, from 1 to 10 - and, depending on the number you get, set the string of a variable to be the name of the enemy corresponding to that number.
And then, use the “Create an object from its name” action - make sure you have all of your enemies in the same Object Group, by the way!

// Setting the Random Value //

If the timer "Spawn" is greater than 1 seconds
Trigger once
  do = RandomInRange(1, 10) to scene variable "SpawnEnemy"

// Assigning an Enemy to each Value //

If scene variable "SpawnEnemy" = 1
  do = "SlimeWalk" to the text of scene variable "EnemyName".

If scene variable "SpawnEnemy" = 2
  do = "Fly" to the text of scene variable "EnemyName".

( And so on with the values from 1 to 10, until all the 10 possible numbers have an enemy name assigned to them. )

// Creating the Enemy //

If the timer "Spawn" is greater than 2 seconds
  among objects "Enemies", create object named VariableString(EnemyName) at position 0;0
  reset the timer "Spawn"

This way, the enemy spawned will be random depending on the random value assigned to the “SpawnEnemy” variable, which is between 1 and 10. Feel free to also randomize the value of the position, too, if you would like!

I hope this helps!

Thank you so much for your help. I had read the documentation but couldn’t find the solution. I might not read it thoroughly enough. I’ll try your solution. Once again thank you… I really appreciate it.