Randomly Spawning Obstacles
I am looking to have an endless game that isn't too long in width. The character stays in the same position, and the rest of the game has motion velocity set so the obstacles/objects come towars the character.
Since I hope that the user plays this game multiple times, I need these objects/obstacles to randomly spawn, in different places every time. The problem is, I'm not sure what the best way to do that is. Do I put them in to the game, and have it change the x and y automatically or have a spawner?
I have about 10-15 objects/obstacles, all different widths and heights, so I don't want them to happen at the same time, no overlapping. Think of Jetpack Joyride in this sense.
Any help is greatly appreciated!
Cheers,
Matt
Since I hope that the user plays this game multiple times, I need these objects/obstacles to randomly spawn, in different places every time. The problem is, I'm not sure what the best way to do that is. Do I put them in to the game, and have it change the x and y automatically or have a spawner?
I have about 10-15 objects/obstacles, all different widths and heights, so I don't want them to happen at the same time, no overlapping. Think of Jetpack Joyride in this sense.
Any help is greatly appreciated!
Cheers,
Matt
Best Answer
-
FluxGames Posts: 33
@tshirtbooth, do you know how to make the actor collide with the platforms smoother in this template? Because now, the bigger speed the actor gains the longer it falls through the actor.
Sorry for bad English.
//MJ
Answers
I've seen a doodle jump template somewhere...
If you can't find it, I can look through some files on my computer when I get home and see if I still have it.
I hope this helps,
Jack McGraw
Also, if you want them to never overlap, what you could do is have an actor that spawns the obstacles. If the actor was touching one of the already spawned obstacles, (overlaps or collides with: actor of tag: obstacle) then it would not be able to spawn any new obstacles. Then, once it wasn't touching anything, (because the obstacles had moved) it would be able to spawn again. This way worked for me with spawning platforms after about three other failed attempts, so it should work.