Transitioning between levels
Your levels now need a way to transition from one to the next. In the res://assets/environment/props.png
sprite sheet, there is an image of a door that you can use for your level’s exit. Finding and walking into the door will take the player to the next level.
Door scene
Make a new scene with an Area2D
node named Door
and save it in the items
folder. Add a Sprite2D
node and use the props.png
image as Texture. Under Region, click Enabled, and then click the Edit Region button to select the door image from the sprite sheet. Then, in Offset/Offset, set y to -8
. This will ensure that when the door is placed at the tile location, it will be positioned correctly.
Add a CollisionShape2D
node and give it a rectangular shape that covers the door. Put the door on the items
layer and set its mask so that it only scans the player
layer.
This scene doesn’t need a script because you’re just going to use its body_entered
signal in the...