Tutorial: Planet Layers
Planet layers are the simplest type of layer available in space generator, with very limited parameters available. They spawn planets randomly selected from a range of sprites at random positions along the x-axis, which will then slowly descend across the screen at a user-specified pace.
Available parameters include:
- SPAWN FREQUENCY
This is a range slider, allowing users to specify a minimum and maximum distance for planet spawns.
When a new planet is spawned, a random value between the minimum and maximum specified distances is selected. When all planets have moved by this value, the planet layer will spawn a new planet so long as the number of planets currently onscreen does not exceed Maximum Concurrent Planets.
- MAXIMUM CONCURRENT PLANETS
Allows the user to specify the maximum number of planets able to be displayed onscreen at any time.
Please note: each planet layer has a separate maximum concurrent planets variable, so if multiple planet layers are active the actual number of planets displayed onscreen may exceed this value.
- SCROLL SPEED
The speed at which the layer scrolls across the screen.
NOTES
Planet layers have been kept intentionally simple, and will not be exported with .png format exports. Instead, all planet sprites used within the project are available to download (under CC0 licence terms) with the intention that the user would design their own system to spawn random planets in their own projects rather than relying on a repeated texture with a handful of planets in the same location.
Need inspiration for how to implement this in your own projects? Feel free to download the source code for space generator to see how this is handled in Godot - you're more than welcome to copy, adapt or improve however you see fit!
Get Space Generator
Space Generator
Procgen CC0 space backgrounds for your games
More posts
- Tutorial: Star LayersJul 08, 2024
- Tutorial: Nebula LayersJul 08, 2024
- Tutorial: Global SettingsJul 08, 2024
- Tutorial: PresetsJul 08, 2024
- Tutorial: ExportsJul 08, 2024
Leave a comment
Log in with itch.io to leave a comment.