Best way to do popup menus

Get help using Construct 2

Post » Wed Jan 04, 2012 3:01 pm

During gameplay, I want to briefly show menus that partially cover the game window, that the player can interact with, then close, and resume gameplay. (so having them on separate layouts is not an option)

There's 2 ways I can think of doing them:

1) Create popup in editor on a layer and turn visibility on/off
Pro: easy to set up in the editor
Con: items in the popup will still get updated even if they are not visible and take up memory (performance)

2) Spawn & destroy popup as needed using system -> create object
Pro/Con: basically the opposite of layers... annoying to create because the popups consist of lots of pieces so lots of 'create object' actions are needed but probably better performance wise

So far I've been using the layer method, but now that I'm up to 6 fairly graphical popup layers that are invisible most of the time and want to add another 2 I'm starting to wonder if there's a better way.

Your thoughts?wgfunstorm2012-01-04 15:01:51
B
22
S
9
G
5
Posts: 122
Reputation: 5,386

Post » Wed Jan 04, 2012 3:04 pm

Oh and one more thing, how do you suggest creating a popup that can be used across multiple layouts? Specifically I have an 'options' popup that I want the player to be able to access from any layout but with the layers method I would have to put the layer in each layout so for that I'm doing the spawning method by embedding an 'options' event sheet into each layout.
B
22
S
9
G
5
Posts: 122
Reputation: 5,386

Post » Wed Jan 04, 2012 4:59 pm

How i made it in my game:
Created an Event Sheet just for the popup or if you want to generalize for the game GUI in whole. It would contain the GUI events like mouse over, mouse out mouse click etc.
Using the Function plugin create functions like CreatePopup, CreateMenu etc, that would be responsible for creating all needed objects, with respective Destroy functions , responsible for cleaning up. Creating and destroying things is very fast no problem on that. More or less like that. Of course you should put a variable telling when to update the Gui components.
B
58
S
13
G
10
Posts: 632
Reputation: 12,505


Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, Sotir31 and 28 guests