How to "hold" an event until a condition is met?

Get help using Construct 2

Post » Thu Feb 07, 2013 5:00 am

I am returning to Construct 2 after some months away, busy with work. Getting back into it is easy and a testament to how user friendly it is. I even fixed a problem I'd gotten stuck on six months ago! Then I got stuck again.

I recall seeing a tutorial about an Action to "hold" (or pause or wait or some similar verbiage) an Event as active until a certain condition or conditions are met (X amount of time passed, velocity == 0 etc).

Can anyone steer me towards that functionality? Either a tutorial, example or manual entry?

B
5
Posts: 20
Reputation: 1,015

Post » Thu Feb 07, 2013 6:11 am

I'd have to see an example of the event in question, but generally you add conditions to the event in question until you've got all of the requirements covered. Just right click on the event you want to add conditions and select "add another condition".
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Thu Feb 07, 2013 6:47 am

You can use the "wait" action (System -> Wait), but it only works for time.

What you are asking for sounds more like a sub-event, though.

For instance, here:



It checks the selected item variable, and if the player is falling. THEN, if these conditions are met, he checks to see if the player is pressing Z.
B
106
S
35
G
37
Posts: 798
Reputation: 25,215

Post » Thu Feb 07, 2013 7:43 am

Thanks for the quick replies! I guess wait isn't actually what I need. Here is the state machine so far:

The states:


The conditions:



The problem is this:
I am trying to get State 6 (sliding) to lock in until velocity = 0, (hence the "start ignoring Platform user input" action.

All of this works and the slide completes as desired before restoring player control, but if I release the Down arrow during the slide it returns to State 1 (Running), even as it slides to a stop. I am hoping to lock the state machine into state 6 (sliding) until it reaches zero velocity.
B
5
Posts: 20
Reputation: 1,015

Post » Thu Feb 07, 2013 8:27 am

Add a variable isSliding. Set it when you start State 6, remove it once State 6 is finished. Add a Not isSliding to the event that sets State 1. (if that made sense)
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Thu Feb 07, 2013 5:13 pm

Yes, that not only made sense; it worked like a charm! I added the IsSliding variable and defined it's action as "Set PlayerState to 6" and it works exactly as intended. Thank you very much!

B
5
Posts: 20
Reputation: 1,015


Return to How do I....?

Who is online

Users browsing this forum: DiabloOvermind, MrWhizm, Skebab, spcsmrf and 23 guests