pause and unpause using same button

Get help using Construct 2

Post » Sun Apr 27, 2014 3:58 pm

Image

Why does that doesn't work? I know I need different buttons for pausing and unpausing when there are NO VARIABLES involved. But I already included a global variable there.

I also tried separating the variables' cause and effect by making 2 more events like this:

+On Return pressed
+GameIsPaused = 0
->Set GameIsPaused to 1

+GameIsPaused = 1
-> Set Time Scale to 0

+On Return pressed
+GameIsPaused = 1
->Set GameIsPaused to 0

+GameIsPaused = 0
-> Set Time Scale to 1

but it still doesn't work.

I really need to use only 1 button (Enter) for pause and unpause in my game.

help please?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sun Apr 27, 2014 4:09 pm

Maybe this capx will help.
You do not have the required permissions to view the files attached to this post.
B
83
S
32
G
23
Posts: 121
Reputation: 15,041

Post » Sun Apr 27, 2014 4:12 pm

Hi, can you give me a screenshot of the events? I can't open it because I am not yet up to date with the latest version. I can't download anything that big filesize on this connection at the moment.
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Sun Apr 27, 2014 4:12 pm

Use a single Keyboard event and make the GameIsPause check a sub-event. Chances are C2 evaluates the first event, and then since you just set GameIsPaused to 1, when the second test is run, it is true, so it sets it back to 0 again.
ImageImageImage
B
71
S
22
G
241
Posts: 3,734
Reputation: 134,494

Post » Sun Apr 27, 2014 4:19 pm

sgn15 wrote:Hi, can you give me a screenshot of the events? I can't open it because I am not yet up to date with the latest version. I can't download anything that big filesize on this connection at the moment.
You do not have the required permissions to view the files attached to this post.
B
83
S
32
G
23
Posts: 121
Reputation: 15,041

Post » Mon Apr 28, 2014 5:41 am

@Kastas
thanks. It worked. I would like to ask you some help again in my expanded pause menu.

First, these are my events
http://oi60.tinypic.com/bh13mh.jpg

When I pause my game, (without leaving the current layout), I create the pause menu objects and text objects, basically pause has 3 options: Continue, Save and Exit, and Exit (go to Main Menu). MPause_Index refers to the option which I am pointing to, since it has only 1 value at a time.

Option 2 (Save and Exit) is blank (no action), don't know how to do the save yet.
Option 3 (Exit) works fine.

Questions:
1. When I change the order of the groups, moving the group "Pause" before the others, all 3 menu options become the same color (this should be impossible). I thought the pausing itself should be at the top since codes are read top to bottom?

2. When I select the first (continue), GameIsPaused is not being set to 0, so the game isn't being unpaused, and also, another set of pause menu objects are being created again and again every time i press enter while already in pause.

3. While in pause menu, when I press up, the player (which has platform behavior) is still showing walk animation first frame only, so the disabling of the platform when GameIsPaused = 1 doesn't work.

help please. thanks in advance
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Mon Apr 28, 2014 1:09 pm

any help?
B
16
S
7
Posts: 301
Reputation: 2,726

Post » Mon Apr 28, 2014 3:33 pm

Did you manage to update C2?
I'm sorry, but all I can offer you now is another capx for dissection.
You do not have the required permissions to view the files attached to this post.
B
83
S
32
G
23
Posts: 121
Reputation: 15,041


Return to How do I....?

Who is online

Users browsing this forum: Jackriduk, Username05 and 25 guests