- Home /
Spawning objects in infinite scroller game
(2D game)
Basic Idea: 2D vertical scrolling plane flying game where the camera follows the plane. There will be lots of items/power-ups scattered randomly throughout the sky, which the player can maneuver the plane to pick up. Some items will have a higher chance to spawn compared to others.
Rather than spawning all the items/power-ups on start, I want to spawn them just outside the camera view as the player moves around the sky at runtime, so as to reduce the number of unnecessary spawning and to allow for an infinite scrolling game.
I'm not sure how to implement the spawning system. All I can think of is to draw invisible boxes around the outside of the camera view, and get the items to only spawn in those boxes as the player moves through the sky. But I can't figure out how to code this. I thought of maybe spawning items at intervals, but then that wouldn't work since the speed of the player would influence how many items spawned in a particular place.
Any ideas or links to other posts that have done things similar to this would be appreciated. I've done a tonne of googling and looking around but I can't find the right info
Your answer
Follow this Question
Related Questions
2d Random object placement help? 1 Answer
Instantiate Random 3D Objects/platforms that dont overlap 1 Answer
How to randomly replace the main platform with additional ones? 0 Answers
Drop item from airplane 1 Answer
Spawning targets on 2 of 4 pre-defined locations using an array and empty game objects? 1 Answer