On Control released

New releases and general discussions.

Post » Tue Mar 23, 2010 5:50 am

Either I don't quite get it or it'd make a lot of sense to add this condition to Construct. There is a 'on control pressed' condition, but no 'on control released condition. Curiously, there's both a 'on key pressed' and a 'on key released' condition.

For example, I'm currently working on a charge beam thingy, so if you hold the button you add a value to a pv, if you release the button the player fires and the clamped value sets itself back to 0.

So, what would be the quickest way to set this up without having a 'on control released' condition?
B
6
S
2
G
3
Posts: 520
Reputation: 2,690

Post » Tue Mar 23, 2010 6:17 am

ControlState is either on or off, 1 or 0

+ System: MouseKeyboard.ControlState("Move Left", 1) Equal to 0
->do stuff
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Tue Mar 23, 2010 7:07 am

I'm not sure that that helps - I want to define an action in the exact moment when I release a button.
B
6
S
2
G
3
Posts: 520
Reputation: 2,690

Post » Tue Mar 23, 2010 7:20 am

[quote="thomasmahler":2ooqq1wm]I'm not sure that that helps - I want to define an action in the exact moment when I release a button.[/quote:2ooqq1wm]
That shouldn't be hard to implement. You just save the current state you're interested in. I haven't worked with control state, but I don't see, why it shouldn't work:

Start of layout
->SomeVar = "Released"

System: MouseKeyboard.ControlState("Move Left", 1) Equal to 1
SomeVar Equal to "Released"
->SomeVar = "Pressed"

System: MouseKeyboard.ControlState("Move Left", 1) Equal to 0
SomeVar Equal to "Pressed"
->SomeVar = "Released"
->do stuff

(Maybe 'trigger once' will do as well instead)
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Fri Apr 02, 2010 11:41 am

In your case it's really easy to do.

+charge is greater then 0
+NOT! key is down
-> blast everyone
-> set charge to 0
B
8
S
2
G
5
Posts: 744
Reputation: 3,288

Post » Thu May 20, 2010 2:46 am

It would be better if this was in the same place as "On Control Pressed" rather than having some funky workaround that I'm not sure how to use anyway.

+1 to the request. The buffer for my fighting game needs this particular feature. :|
B
2
G
3
Posts: 19
Reputation: 888


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 3 guests