Previously, in part 1 of this series, we learned how to create a Godot project and add scenes and nodes. In part 2 of this series, we learned how to add animation to the player node.
In this article, we will add a background to our game.
This is going to be a very short article, just focusing on adding background to our game.
First, create a new scene, and name it “Background”.
We create a node, and select “ParallaxBackground”.
As the documentation says, ParallaxBackground uses one or more ParallaxLayer child nodes to create a parallax effect. Each ParallaxLayer can move at a different speed using ParallaxLayer.motion_offset. This creates an illusion of depth in a 2D game. If not used with a Camera2D, you must manually calculate the scroll_offset.