Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Thank you for playing my game! The way in which I made it was to:

  •  First define a Public GameObject that will spawn the obstacle
  • Define a maximum and minimum  X and Y float variable so the game knows how wide and high to place the obstacles in each loop
  • Next I made a method called Spawn() that will hold the code to randomise the placements
  • Used a command called Random.Range() including the min max floats (this will throw the objects in different places within the parameters)
  • Then once I did that all I needed to do was instantiate the obstacle within the Spawn() method whenever I needed new obstacles while using a box collider to wipe away the old objects away from the players view. 

I don't particularly know if my way is the best way because im a newish developer. But that's how I learned to do it. I hope this helped 😅

(+1)

Ohhhh that makes sense! Calling Random.Range() for where to spawn is smart. Cool! Thanks, I appreciate it!