How do I create endless traffic (just cars) that drive by in random lanes for the format of my game?
The traffic is supposed to be an obstacle.
Create a spawner object to spawn the cars, then set up a random timer to spawn them.
That’s one option, or you can have a single spawner object spawn for both lanes. This isn’t hard, you’ll just alternate between spawners. This one you can also use to make sure that both lanes aren’t filled at the same time, that would auto kill the players
I have done this however on each spawn it multiplies the amount of spawned cars and will eventually crash the game. You can see this happen by coming to a complete stop and watching the cars multiply.
This (the game concept) sounds similar to the latest Flowlab YouTube series “Create a mobile game”.
Check it out, it will teach how to spawn/emit objects and make an infinite game
The cars are spawning themselves. You should have a secondary object as I mentioned do this instead.
When a car is spawned, it stays in the game forever. That means it’s constantly running. So now you have several cars driving, all of them spawning more cars, which is why you see multiple going at once.
You should also use the In-View behavior to remove the cars once they’re far enough off-screen to improve performance by not running unneeded code/physics.