In this part, I will show you how to be able to move between levels 1,2,3,etc when reaching the end of a level.
| Join the channel Telegram of the AnonyViet 👉 Link 👈 |
Create New Scene
First, you create a new Scene with Area2D as the root node.
Here, I use Area2D because I will create an area and when the PLAyer enters it will move to the next level.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 35 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 31](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-31-12.png)
Done, then save it in the Scene folder.![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 36 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 32](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-31-38.png)
Next, add the script to it.
The script includes the following:
extends Area2D
export (String,FILE) var LevelKeTiep
func _on_KhuVucDiChuyen_body_entered(body):
if body.name == "Player":
get_tree().change_scene(LevelKeTiep)
I declare a variable and this variable is special where I use it export(this is the command that will make the variable appear outside the Inspector so it can be easily edited)
I add (String,FILE) behind to be able to select files from outside the Inspector.
You can find more documentation here: GDScript exports
As for the function below, you have to connect signal to appear.
if body.name == “Player” is that I check that if the Body comes in and the name is Player (name of the character scene that you and I created), it will move to the Level assigned to the above variable.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 38 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 34](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-48-24.png)
You click on Area2D
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 39 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 35](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-50-53.png)
Through the Node tab, click 2 and click on the enter body (here I use the body entered because the Player is a KinematicBody2D, so I will use the signal to determine when a body enters Area2D)
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 40 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 36](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-49-01.png)
The table that appears, select Area2D and then click Connect.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 42 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 38](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-49-19.png)
You can know that the signal has been connected successfully by looking at the two symbols in the two pictures above.
New Level
After you’re done, create yourself a new level similar to how you create a Scene Map.![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 43 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 39](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-57-21.png)
After creating a new 2D node, rename it to map2.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 44 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 40](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-57-35.png)
And instead of redoing the tilemap you can go to the first map to copy it.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 45 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 41](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-57-46.png)
Go to map 2 and paste it out.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 46 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 42](https://anonyviet.com/wp-content/uploads/2021/11/12-11-2021-11-57-59.png)
After pasting, we get the same tilemap as the first Map and you just need to adjust it![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 47 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 43](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-00-03.png)
My Map 2 after editing.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 48 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 44](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-08-18.png)
Add Player and Background like Map 1, copy it and you’re done.
Instance teleportation area
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 49 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 45](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-01-21.png)
You Instance node has just moved to Map1 ![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 50 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 46](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-01-33.png)
Right-click and select editable children to edit it.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 51 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 47](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-01-45.png)
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 52 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 48](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-01-55.png)
Select CollisionShape2D and select its shape.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 53 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 49](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-02-10.png)
After selecting the shape, it will appear like this.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 54 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 50](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-02-44.png)
And you drag it to the place where we need to change the level by clicking on the Area and clicking the move icon on the toolbar, but don’t drag the CollisionShape2D away.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 55 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 51](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-03-27.png)
I have moved to the position I want and I edited the CollisionShape2D so that it is reasonable.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 56 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 52](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-06-44.png)
You won’t be able to move yet because you haven’t told it which scene you want to move through, so in KhuVucDichChuyen click on the folder icon.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 58 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 54](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-07-41.png)
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 59 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 55](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-08-41.png)
Find and select Map2 then click Open.
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 60 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 56](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-10-21.png)
Once done, Map2 has been added to the LevelKeTiep variable![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 61 [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels 57](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-11-11.png)
![[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels [Tạo 2D Platformer Game với Godot] Part 9: Moving between levels](https://anonyviet.com/wp-content/uploads/2021/11/13-11-2021-12-15-46.png)
Above, when I enter, I will be transferred to Map2.
Here, you can apply many ways to make the most of it, such as:
- Set camera limit in front of the moving area
- Add Sprite in Scene KhuVucDiChuyen for easy identification.
summary
In this section, I have shown you how to move between levels together and depending on your creativity and understanding, you can design many other things.









