[Solved]Problem with Time Scale

Get help using Construct 2

Post » Fri Dec 06, 2013 6:49 am

Hey!

I am trying to make a pause menu and, well, take a look at my code.



I can press the menu button and it pauses the game and displays the pause menu. But when I press the menu button again, the pause menu will not disappear and the time scale will not set it self back to 1.0.Tekniko2013-12-06 09:15:03
B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Post » Fri Dec 06, 2013 7:20 am

Before the action "Set time scale to 1.0", put a "Wait 0" action. :)Jase002013-12-06 07:20:41
B
51
S
20
G
10
Posts: 571
Reputation: 9,819

Post » Fri Dec 06, 2013 7:41 am

Easiest way to fix this is to replace the is not visible by system else.
This is actually the best example for a place to use the system else event.

Another way, of which I'm fond myself to make the toggle is:

on button touched : system set timescale : 1-timescale

this way
when timescale = 1, 1-1 returns 0
when timescale = 0, 1-0 returns 1
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 06, 2013 7:55 am

@Jase00 that just broke the button. Now it does nothing.

@LittleStain I am not how that would work exactly.
B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Post » Fri Dec 06, 2013 8:02 am

Right click on the is not visible event, choose replace condition, make it system else.

or do you mean the second one?

just add the set timescale : 1-timescale
to the on left button clicked event as the action and remove the subevents.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Dec 06, 2013 8:30 am

@Tekniko

I suggest you to try the system condition 'Else' instead of (or with) the 'Is not visible'

Your problem occurs because first:

-Your sprite is visible, so the game unpause and make the sprite invisible
-Then in the same tick, since it just became invisible, the game pauses and makes the sprite visible

The Else condition will correct that
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Dec 06, 2013 9:14 am

So the Else statement didn't work either. I'm sure I just messed it up.

I went with 1-timescale bit. Very simple and gets the job done. Thanks all.
B
56
S
15
G
13
Posts: 826
Reputation: 17,645


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo and 30 guests