8
Splitting and Reusing Scenes
It is possible to create the whole game within one Godot scene, but this can get quite unwieldy. Not only do we have to recreate every part over and over again, such as every boulder or enemy, but if we want to change something about the rocks, we have to go and find every rock to change them.
This is not scalable for any kind of game. Luckily, in Godot, there are such things as scenes. In Chapter 2, we saw how to create new scenes from scratch, but in this chapter, we will learn how we can create a scene for each element so that we can easily reuse it throughout the game. This way, we can make one scene for the rocks and use that to populate the arena instead of having multiple unique rocks.
Next to reusing components, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access