In this section, I will show you how to add Background and adjust the camera to make it more reasonable and beautiful.
| Join the channel Telegram of the AnonyViet 👉 Link 👈 |
Character error
Then in the previous part, I showed you how to rotate the character and some of you will have an error that when rotating the character, it will fall or jerk, here is how to fix it.![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 28 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-21-25.png)
You are getting the error that is because the character it is like this, because it is out of position.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 29 [Tạo 2D Platformer Game với Godot] Part 6: Adding a 25 . Background](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-21-29.png)
You will have to reset the center position.
Then it won’t happen again.
Background
Download
In part 2, when I provided the link to download the tileset, it already included the background, if you delete it, you can download it again at the following link: Swamp 2D Tileset
Setting
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 31 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 27](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-26-16.png)
You download and put the background image in Folder 2 Background into the folder Assets of the game.
Type 1
You guys add yourself the ParallaxBackground node![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 33 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 29](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-33-36.png)
Add a Sprite node that is a child of the Background node.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 34 [Tạo 2D Platformer Game với Godot] Part 6: Adding a 30 . Background](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-34-24.png)
You select the Sprite button and then drag the background image file to the Texture.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 35 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 31](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-35-16.png)
You will be like this.
And you remember for yourself that the blue frame is the frame that the user can see.![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 36 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 32](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-36-52.png)
I will drag the background to fit the green frame.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 37 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 33](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-38-41.png)
Then run the game you will see the background it has appeared and always moves with you.
Type 2
If you want the background not to move with you then do the following.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 38 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 34](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-40-00.png)
You create one more ParallaxLayer node and put the Sprite as a child of that node.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 39 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 35](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-40-56.png)
Then at the button ParallaxLayer -> Motion you will see the Mirroring section, then at x you adjust to 1000 for yourself.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding a 40 . Background [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 36](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-41-40.png)
After adjusting to 1000 you will see that there will be 1 more background appearing and I call this Infinity Background.
You design your level to where you set the Background it there.
Camera
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 41 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 37](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-43-52.png)
I will also show you how to optimize the camera to look good, if you look at the picture above, it won’t look good at all.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 42 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 38](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-46-55.png)
First, you have to see for yourself the coordinates that you want the camera to only move to by zooming in where you want to go and viewing in the coordinate bar.
Here on the left I want the maximum camera angle to be at coordinate 0, below it is 550, above it is 0 notes.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 44 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 40](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-50-35.png)
After I have the coordinates, I will go to Player -> Camera2D -> Limit and fill in the coordinates.![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 45 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 41](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-51-42.png)
I will be like this after editing, it looks very good.
Camera by map
There will be different maps and each map’s camera you will have to limit differently, so if you adjust in Player, when in another map, this part will fail.
Therefore, I have this way so that you can adjust the camera limit according to each map.![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 46 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 42](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-54-16.png)
You go to the map you want then select Player right click -> click Editable Children (allows you to edit the Instance node as a child node)
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 47 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 43](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-55-12.png)
Then you find Camera2D and adjust it again.
Adjust the game when zooming in and out
When zooming in and out of the game according to the default settings, the game will not keep as default but it will be small![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background 48 [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 44](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-56-50.png)
For example, this is when I zoom out.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding Background [Tạo 2D Platformer Game với Godot] Part 6: Adding Background](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-57-35.png)
And this is when zoomed out according to other settings.
It depends on the game you want to make and how you want it to be.
![[Tạo 2D Platformer Game với Godot] Part 6: Adding a 50 . Background [Tạo 2D Platformer Game với Godot] Part 6: Adding Background 46](https://anonyviet.com/wp-content/uploads/2021/11/10-11-2021-10-58-44.png)
To be like this, you go to Project Settings, find Display, select Window and adjust in Mode, Aspect it has many modes for you to explore.
Summary
So in this part, I showed you how to add a background and adjust the camera so that it is reasonable.










