0 votes

Hey all, I'm trying to add a pause menu to my game but I'm running into the problem where the pause menu is fixed to the initial viewport area and doesn't move as the player moves. My current scene layout is roughly as follows:

  • Game (Node)

    • World (Node2D)

      • Tilemaps
      • Player (KinematicBody2D)
    • PauseMenu (Control)

The issue of course is that when the player moves beyond the bounds of the viewport in the world, the pause menu does not follow the current viewport and so I don't get the menu to pop up unless the player moves back to the starting viewport area.

What's the best way of structuring this so that I can keep everything uncoupled and don't have to resort to e.g. attaching the pause menu to the player's camera or something? I imagine there must be a way of specifying that something always be anchored to the viewport, so to speak. I could also see something like that being useful if I wanted to e.g. apply a shader to the entire viewport.

Thanks in advance for the help!

asked Jun 8, 2019 in Engine by AUD_FOR_IUV (41 points)

1 Answer

+1 vote
Best answer

Use a CanvasLayer.

answered Jun 8, 2019 by sparkart (327 points)
selected Jun 8, 2019 by AUD_FOR_IUV

Brilliant, so simple. Thanks a lot!

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.