Level complete or failed screen using popup

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By vbdev

Hello everyone,

In my game when a level is either completed or failed, I am spawning a child scene. The child scene has buttons such as MENU, RESTART & NEXT buttons. It also has level number, show earned stars etc. The scenes are made using control nodes & they are looking nice. I AM NOT USING POPUP NODES.

Above is working properly, but I am posting the question because now I want to make more such scenes (for rate-us, share app etc) which when required will popup above the main scene. And I want to know whether whatever I am doing is a good/normal approach.

I am confused about popup nodes such as WindowDialog, PopupDialog, PopupPanel etc. Can I use these popup nodes to build similar scenes (or making the popups inline in code only)? I have searched on net but could’t find any good example of popup nodes having fancy looks which can be used in games. Thanks!

:bust_in_silhouette: Reply From: exuin

All a popup node is just a control node that has special methods for hiding and showing itself. For the PopupPanel node, you’re meant to style it yourself and add the children yourself. WindowDialog is for more specific use cases and you probably don’t want to use it for your use case.

Your approach is fine. Popup nodes are just a shortcut for making elements that display over everything else.

Thank you very much.

Following your suggestions, I also created child scene having a PopupPanel as root node, added it as child & then use popup() to show it. I styled the same as required using StyleBoxFlat style.

The advantage I found using it is that if user clicks outside of the panel it will close or I can make it exclusive if required. Thanks again!

vbdev | 2021-05-25 08:59