How do I flip gravity using a key?

Get help using Construct 2

Post » Fri Jan 20, 2017 10:21 am

I am looking at setting up a simple gravity switch when the player presses a key, so far I have this ...

Image

But there is no reaction when I press the space bar at all.
B
10
S
3
Posts: 52
Reputation: 806

Post » Fri Jan 20, 2017 10:50 am

Yes, wel. You set gravity to -1500 in the first event when it is different than -1500.
So, the second event is ALWAYS true.

Add system> else to the second condition.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jan 20, 2017 12:09 pm

Use a variable for gravity.

Here:

Global Variable: GravVar = 0

Keyboard ON SPACE KEY RELEASED

> GravVar = 0 | WAIT 0.1 Seconds.
| Set GravVar to 1

> GravVar = 1 | WAIT 0.1 Seconds.
| Set GravVar to 0

GravVar = 0 | Set Player Gravity to 1500
GravVar = 1 | Set Player Gravity to -1500
Image Image Image
B
31
S
11
G
27
Posts: 748
Reputation: 17,093

Post » Fri Jan 20, 2017 1:01 pm

Thank you ever so much @MPPlanetOfficial and @99Instances2Go, solved!
B
10
S
3
Posts: 52
Reputation: 806


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 41 guests