STEP 2: Use a Portal to Move Between Scenes
- Switch to the
game_scene
tab. UnderObjectRoot
, create a newPortal
node.
- Set the portal’s properties:
- Set the input direction to right.
- Leave the Target Scene Path blank for now.
- Set both the Entry Effect and Exit Effect to
BLACK
.
- Add Layer 2 to the
CollisionMask
.
This is because the sample player is on Layer 2. If the mask only includes Layer 1, collision will not occur.
- Move the Portal node itself (not just the PortalCollision) to the far right side of the stage.
The position of the Portal node determines the spawn location in the next scene. - Resize the PortalCollision, making it narrower to avoid accidental triggers.
- Now create the destination scene:
- In the File System, duplicate
game_scene.tscn
and name itgame_scene2.tscn
.
- Open
game_scene2
and delete the player object.
Otherwise, the player would appear twice. - Move the
Portal
node to the left edge of the map.
- Adjust the position of the
PortalCollision
.
If it’s on the right side of the Portal node, move it to the left instead.
- Change the
Portal
properties ingame_scene2
:
- Set the input direction to left.
- Set the Target Scene to
game_scene.tscn
. - You should now be able to select the portal in
game_scene
.
- Return to
game_scene
.
Likewise, set the Target Scene togame_scene2.tscn
and choose its portal.
- Test play the game.
If everything is configured correctly, you should be able to move freely between the two scenes.
Conclusion
This marks the end of the Script Course tutorial series.
The contents of this tutorial cover only the basics.
With ACTION GAME MAKER’s Visual Scripting, you can create a wide variety of behaviors by combining conditions and actions.
With your imagination, you might even build something we developers never anticipated!
If you come up with something cool, be sure to share it on social media or the official guild.
Want to take other courses?
1. Graphics Course
For those who want to animate their own original characters.
3. Expression Enhancement Course
For those who want to add cool, Godot-style visual effects.