Skip to content

Main Elements

kobewi edited this page Dec 29, 2024 · 4 revisions

Top-level elements of the sample project, not related to specific rooms.

Game scene - room transitions, map and minimap

Game.tscn is the main scene of the project. It contains player with camera and UI. Player is a separate scene with CharacterBody2D root. It uses the default template controller, with some modifications like double jump and reset position. UI nodes are Minimap, FullMap (with Percent) and CollectibleCount. Their logic is contained inside built-in scripts. The CollectibleCount is managed by Game, which has the only external script in this scene.

Game scene manages room transitions and project-specific save data. The script inherits MetSys Game. Check the comments in Game.gd for more details. Other functions in this scene are Minimap, Map Window and discovered percentage label. The minimap is made using the Template's Minimap node, while the map window uses MapView (but it can technically use/extend Minimap too).

Collectibles

Orb collectible is scene Collectible.tscn. It's a storable object - collecting it will make it never appear again. It shows a marker when discovered and when collected. It also increases the Game's collectible counter. MapItem.tscn is the same, but instead of increasing a counter, it discovers a room group.

Custom elements

CustomElements.gd shows an example implementation of CustomElementManager. The available elements are elevator and label.