Make the same Key both Pause and Unpause the game.

Get help using Construct 2

Post » Sat Sep 19, 2015 4:10 am

So far this piece of code works great:

Key Press Condition > Set Timescale to 0 Action

How do you make it so the same key press pauses the game, and unpauses the game.

Key Press B > Set Timescale to 0

Is it possible to also make Key Press B > Set Timescale to 1.0

So B both pauses the game, and while the game is paused, pressing it again unpauses the game (as in, the same key that sets the Timescale to 0 also sets the Timescale to 1.0 when the Timescale is 0 )
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Sat Sep 19, 2015 4:13 am

Press Key > Set Timescale to 0 works perfectly, and I don't want to mess with that.

Now, the issue is making it so the Key that when pressed sets the Timescale to 0 is the same key that when pressed, sets the Timescale to 1.0 WHILE the Timescale is 0.

Timescale is currently 1.0

Press B

Timescale is now 0

Press B

Timescale is now 1.0
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Sat Sep 19, 2015 6:57 am

@Pheonixbowman,

just put a condition checking the current timescale and changing it accordingly...

press B
if timescale == 0 then timescale := 1.0
else
timescale := 0

that should do it.
B
81
S
32
G
23
Posts: 1,053
Reputation: 35,965

Post » Sat Sep 19, 2015 7:28 am

You could even put it into a single expression like
set timescale: timescale = 0?1:0
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sat Sep 19, 2015 9:47 am

mindfaQ wrote:You could even put it into a single expression like
set timescale: timescale = 0?1:0


Or set timescale = 1-timescale
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 » Tue Sep 22, 2015 5:18 pm

Message: Phoenixbowman is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
I cannot find the If statement and Else statement. I checked under System and it's not there.

I am looking here: but it has no mention of where in System If, Else, and Then are. I created a New Event, and searched for If, Else, and Then, but those 3 things were not there.
Last edited by Phoenixbowman on Tue Sep 22, 2015 5:23 pm, edited 1 time in total.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Sep 22, 2015 5:21 pm

Phoenixbowman wrote:I cannot find the If statement and Else statement. I checked under System and it's not there.


There are the "system compare variable" and the "system compare two values"
The system else condition is there, but only if it's possible at that spot..
Another way to get to the else statement is through the right-mouse-button-dialog
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 » Tue Sep 22, 2015 5:26 pm

I am just not getting this. I am trying to duplicate this:

press B
if timescale == 0 then timescale := 1.0
else
timescale := 0

Press B is the event. If Timescale is the action, but compare variable is not available under actions.

Press B is the event, and the if else and then are the actions, but compare variable is not availble under actions.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634

Post » Tue Sep 22, 2015 5:36 pm

Image

Image

Image
B
66
S
24
G
7
Posts: 1,515
Reputation: 11,041

Post » Tue Sep 22, 2015 5:57 pm

korbaach wrote:Image

Image

Image


Omygosh thank you so so so much everyone! That worked like magic. I understand the sub-events now. When i first saw sub-events i thought "What, like the Metro system?" (ahaha, not really. But i really did not understand them.)

Thank you again!
Last edited by Phoenixbowman on Tue Sep 22, 2015 6:00 pm, edited 1 time in total.
B
20
S
7
G
3
Posts: 302
Reputation: 3,634


Return to How do I....?

Who is online

Users browsing this forum: dand, mickclarke and 27 guests