Skip to content

MetSys Game

kobewi edited this page Feb 26, 2025 · 3 revisions

MetSysGame is a script to use for your main game scene. It provides map management and can automatically track player position. If you call set_player(), the provided Node2D will be used for MetSys.set_player_position() called at the end of every physics frame. load_room() allows to load a new map and add it to scene tree. If previous map already exists, it's automatically removed before the new one is loaded. You can use scene name (located in the map root folder) or an absolute path to the scene. There is also add_module() method that adds a MetSys Module to your Game. Built-in modules do not require additional setup, but if you have a custom module that needs configuration, the add_module() method returns a module instance that you can customize.

The script is located at Template/Scripts/MetSysGame.gd inside the addon's folder. The aforementioned modules are located in Modules directory.

Code Documentation

Like core runtime classes, the template comes with some documentation. The scripts with documentation are:

  • "addons/MetroidvaniaSystem/Template/Scripts/MetSysGame.gd"
  • "addons/MetroidvaniaSystem/Template/Scripts/MetSysModule.gd"
  • "addons/MetroidvaniaSystem/Template/Nodes/Minimap.gd"
  • "addons/MetroidvaniaSystem/Template/Scripts/SaveManager.gd"

Room Transitions Module

Listens for room_changed signal and automatically changes scenes and moves the player to a correct position. For example if you exit a room to the right, the module will load the connected scene and teleport the player on the left side of the entered room.

Call add_module("RoomTransitions.gd") in your Game script to include the module.

Scrolling Room Transitions Module

Same as Room Transitions, but instead of an instant transtion, the screen will scroll between rooms (similar to 2D Zelda games). It works best when there is no diagonal movement involved, i.e. the width and height are uniform between rooms.

Call add_module("ScrollingRoomTransitions.gd") in your Game script to include the module.

Passage Automapper Module

Tracks the player position and automatically adds passages that don't exist on the original map. Whenever you cross a border that's marked as a wall, this module will add a CellOverride that changes the border to a passage.

Call add_module("PassageAutomapper.gd") in your Game script to include the module.