- Home /
Infinte Runner spawn logic
Hello, I am currently creating an infinite runner game. I have the basis for my spawn manager. But I have been prowling the web and can't seem to find what I need to polish it off. How could I accomplish some kind of logic that tells my code "Hey, the objective has spawned in this location, do not spawn an obstacle within X amount of time/place".
The closest thing I can imagine is creating a method which spawns obstacles and objectives, and then throwing in if statements. But I'm not too sure how it would work, and the ways I have tried is not successful.
Answer by Zaeran · Dec 25, 2021 at 05:40 AM
Sounds like you need some kind of cooldown timer. When you create the objective, set the timer to a value. When that value hits 0, it's safe to spawn things again.
Thank you! I know it's a super late reply but I ended up moving on and refocusing on it recently. What I ended up doing is setting timers for each individual prefab to be initiated. And then for the obstacles that could spawn on top of the runways, I just have the game check if this has happened and then delete the obstacle. Which means I could decrease the timer of these obstacles because the excess would be deleted!
Your answer
Follow this Question
Related Questions
Infinite runner stop everything when player dies? 1 Answer
If jumping, rotating in air (like in Geometry Dash or The Impossible Game) 0 Answers
I need help with sliding in infinite Runner please someone help 1 Answer
Infinite runner 3D and lighting 0 Answers
Can anyone help me with my 2D endless runner overlapping platforms? 0 Answers