Toggling on and off a event with the same key

Get help using Construct 2

Post » Sat Oct 15, 2016 3:36 am

Hi there guys! here's the deal....i'm trying really hard to toggle a certain even in my project with the same key:
so here's what i've been doing so far,i've set 3 global variable to the event i want to activate(default one=0,On=1,Off=2)
if you press the Z key the value is set to 1 and the lerp function is On
now i would like to use the same key again to set the value to 2(so it can be deactivated)
what can i do? thank you for you help!
here's a screenshoot of my event sheet hope it helps!
Image
B
10
S
3
G
1
Posts: 28
Reputation: 981

Post » Sat Oct 15, 2016 4:35 am

If your issue has anything to do with both events triggering at once, try putting a simple 'Wait 0.01 seconds' above the other actions. If this isn't your problem, I can't really help you.
Oh, okay.
B
23
S
6
Posts: 41
Reputation: 1,405

Post » Sat Oct 15, 2016 3:02 pm

Nope..the fact is that i would like to trigger an event with the z key(and it remains triggered) and then set it off with the same Key,i'm trying to make a *LOCK-ON* system for targeting enemies,thank you for your help anyways! :3
B
10
S
3
G
1
Posts: 28
Reputation: 981

Post » Sat Oct 15, 2016 3:06 pm

Do you mean trigger it again on release of the button after a certain amount of time?
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Sat Oct 15, 2016 4:15 pm

something liket that.i mean like..let's assume i have a button and if i press it the light on my room turns on and if i release it nothing change,than i press it again and the light turns off,this is i would like to do
B
10
S
3
G
1
Posts: 28
Reputation: 981

Post » Sat Oct 15, 2016 8:41 pm

From your screenshot above, you probably want
Z is pressed, condition (lockon=0) - set lockon to 1
Z is pressed, condition (lockon=1) - set lockon to 2

Don't use 'is down' or the key will be down during all variable changes and change the variable from 0 to 2.

If you actually do want to be able to hold the key down for some reason then you can use 'trigger once'
B
47
S
18
G
84
Posts: 2,271
Reputation: 49,796

Post » Sat Oct 15, 2016 9:08 pm

B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests