• Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
AnonyViet - English Version
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office
No Result
View All Result
AnonyViet - English Version
No Result
View All Result

[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels

AnonyViet by AnonyViet
January 27, 2023
in Tips
0

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

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levelsFirst, 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 31

Done, then save it in the Scene folder.[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 32

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)

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 33I 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 34

You click on Area2D

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 35

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 36

The table that appears, select Area2D and then click Connect.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 37 [Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 38

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 39

After creating a new 2D node, rename it to map2.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 40

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 41

Go to map 2 and paste it out.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 42

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 43

My Map 2 after editing.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 44

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 45

You Instance node has just moved to Map1 [Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 46

Right-click and select editable children to edit 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 48

Select CollisionShape2D and select its shape.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 49

After selecting the shape, it will appear like this.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 50

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 51

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 52

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 53 [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 55

Find and select Map2 then click Open.

[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 56

Once done, Map2 has been added to the LevelKeTiep variable[Tạo 2D Platformer Game với Godot]  Part 9: Moving between levels 57

[Tạo 2D Platformer Game với Godot] Part 9: Moving between levels

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.

The article achieved: 5/5 – (100 votes)

Tags: GameGodotLevelsmovingPartPlatformertạovới
Previous Post

How to use Warp+ unlimited data with CloudFlare Teams

Next Post

What is repeater? How to configure Wifi Xiaomi Repeater version 2

AnonyViet

AnonyViet

Related Posts

Instructions for receiving Lovable Pro 12 months for free
Tips

Instructions for receiving Lovable Pro 12 months for free

May 29, 2026
Instructions for receiving 1 month of ElevenLabs Creator for free worth
Tips

Instructions for receiving 1 month of ElevenLabs Creator for free worth $22

May 25, 2026
How to create beautiful studio-like preschool graduation photos for your child
Tips

How to create beautiful studio-like preschool graduation photos for your child

May 21, 2026
Instructions on how to change iPhone fonts beautifully with Lara
Tips

Instructions on how to change iPhone fonts beautifully with Lara

May 20, 2026
Create images of guardian mascots using AI according to year of birth
Tips

Create images of guardian mascots using AI according to year of birth

May 20, 2026
Try the Shopee Profit Calculator now, avoid the risk of selling at a loss
Tips

Try the Shopee Profit Calculator now, avoid the risk of selling at a loss

May 19, 2026
Next Post
What is repeater?  How to configure Wifi Xiaomi Repeater version 2

What is repeater? How to configure Wifi Xiaomi Repeater version 2

0 0 votes
Article Rating
Subscribe
Login
Notify of
guest

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments

Recent News

How to turn off Gemini Nano on Chrome to free up 4GB of memory

How to turn off Gemini Nano on Chrome to free up 4GB of memory

May 30, 2026
Instructions for receiving Lovable Pro 12 months for free

Instructions for receiving Lovable Pro 12 months for free

May 29, 2026
How to extract text from photos using Zalo is super simple

How to extract text from photos using Zalo is super simple

May 29, 2026
HONOR 600 in hand – High-end design, 200MP camera, not cheap price

HONOR 600 in hand – High-end design, 200MP camera, not cheap price

May 28, 2026
How to turn off Gemini Nano on Chrome to free up 4GB of memory

How to turn off Gemini Nano on Chrome to free up 4GB of memory

May 30, 2026
Instructions for receiving Lovable Pro 12 months for free

Instructions for receiving Lovable Pro 12 months for free

May 29, 2026
How to extract text from photos using Zalo is super simple

How to extract text from photos using Zalo is super simple

May 29, 2026
AnonyViet - English Version

AnonyViet

AnonyViet is a website share knowledge that you have never learned in school!

We are ready to welcome your comments, as well as your articles sent to AnonyViet.

Follow Us

Contact:

Email: anonyviet.com[@]gmail.com

Main Website: https://anonyviet.com

Recent News

How to turn off Gemini Nano on Chrome to free up 4GB of memory

How to turn off Gemini Nano on Chrome to free up 4GB of memory

May 30, 2026
Instructions for receiving Lovable Pro 12 months for free

Instructions for receiving Lovable Pro 12 months for free

May 29, 2026
No Result
View All Result
  • Home
  • News
  • Software
  • Knowledge
  • MMO
  • Tips
  • Security
  • Network
  • Office

wpDiscuz
0
0
Would love your thoughts, please comment.x
()
x
| Reply