Pause/Item/Stuff Menu

For questions about using Classic.

Post » Sat Feb 27, 2010 3:07 pm

You know how in every RPG or game with RPG elements the pause menu has all the items, stats, etc? I was wondering how you'd create this. The actual creating of it isn't hard, but how to fit it into the rest of the game correctly might be.

I was thinking I'd just create a layer with the stuff in it, but if you have lots of images in your menu, that only adds to VRAM (although you could solve this with optimization and using low res images which works in most cases). I then noticed there was a Layout Object which can put one layout in another. There's no page on the wiki about it and I'm not sure how it will work or if it can interact correctly for changing things in the game layout (eg. using an item, equipping a weapon) and be updated with current stats and all that.

I also have the problem with the pausing of the game itself. I was just setting time scale to 0 for pausing, but I hear that would mess up sounds/music. I have no idea how to do this then or how to create a custom pause.

Edit: I looked at the Layout Object and noticed it has its own pause setting, but that will still pause my sounds won't it? Could I create two Layout Objects, one for Music (since only music will need to carry over into the menu right?), one for the menu, then when the menu one appears, it freezes the main window but the Music Layout Object keeps playing?
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Feb 27, 2010 3:24 pm

The layout object is (I think) bugged a bit right now.

You should be fine with a hidden/visible layer method though, and using timedelta and timescale to pause the action when the menu, inventory etc. is open.
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Sat Feb 27, 2010 4:09 pm

Okay, but when you use Time Scale, it pauses all sounds doesn't it?
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Feb 27, 2010 4:10 pm

It still plays music if it's played like music.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Sat Feb 27, 2010 4:21 pm

[quote="Somebody":1c3mphxo]It still plays music if it's played like music.[/quote:1c3mphxo]
Thanks. That clears that up.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794

Post » Sat Feb 27, 2010 11:37 pm

This is the code for my pause menu. I tried another way (using Layer 4's visibility rather than global variables) but it had the same problem. When Enter Key is Pressed, it sees 'pause' as 1 and then sets it to 0. Then it checks the next subevent and sees it as 0 and sets it back to 1! If I switch the order of those subevents, it won't pause at all because the last variable change sets 'pause' to 0. Anyone know a way to fix this? I want pressing Enter to pause when not paused, but resume when already paused.
[code:i8ltavow]On Enter Key Pressed
---Is global variable 'pause' = 1 > Set global variable 'pause' = 0
---Is global variable 'pause' = 0 > Set global variable 'pause' = 1

Is global variable 'pause' = 1 > Set Timescale = 0
> Set Layer 4 Visible

Is global variable 'pause' = 0 > Set Timescale = 1
> Set Layer 4 Invisible[/code:i8ltavow]

Edit: Added Else to the second subevent and it works.
B
2
S
2
G
2
Posts: 372
Reputation: 1,794


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests