Two different actions with the same key?

Just started using Construct 2? Post your questions here

Post » Wed Dec 07, 2016 10:34 pm

I have a dialogue system that has two states. Either "WaitForInput" = 0, or 1.

Meaning it has a state when the text is still scrolling by and when the text is finished and awaiting the player's input to continue.

I want to let the player hit the Enter key to skip the dialogue to the end of the scrollby, as well as use the Enter key to advance the dialogue when it has finished the scroll as well. (As defined by those two separate functions)

Image


The issue is when the player hits 'Enter', it does skip to the end the first time, but then when Enter is hit another time to advance the dialogue, it automatically skips to the end of that dialogue- negating the scrollby effect. To my understanding- it's because it's functioning like:

WaitForInput = 1, meaning the dialogue has ended. Player needs to hit Enter to advance the dialogue.

Player hits Enter.

Dialogue is advanced and is scrolling by, but because the switch caused WaitForInput to equal = 0 now, at the same instant that Enter is still being pressed, it activates the skip function every time.


I think there is a fundamental easy step I'm missing to ensure that double-actions don't happen on single key functions, but I'm just not seeing it. I know this has got to be a problem someone else has faced before. Any insights?
B
21
S
5
Posts: 109
Reputation: 1,500

Post » Thu Dec 08, 2016 12:18 am

Invert your logic. Triggers are best placed at the top level, then check WaitForinput=1 Continue... Else Skip... The Else is important as it insures only one condition can be checked at a time.
ImageImageImage
B
71
S
22
G
259
Posts: 3,793
Reputation: 143,702

Post » Thu Dec 08, 2016 1:05 am

That's exactly what fixed it! Thanks!
B
21
S
5
Posts: 109
Reputation: 1,500

Post » Sun Dec 11, 2016 3:07 am

This has bothered me also. Could someone please show an example capx or an image of the code.
B
30
S
15
G
17
Posts: 137
Reputation: 10,873

Post » Wed Dec 14, 2016 5:55 am

How to trigger two things into the same key using else?
B
30
S
15
G
17
Posts: 137
Reputation: 10,873

Post » Wed Dec 14, 2016 6:47 am

ImageImageImage
B
71
S
22
G
259
Posts: 3,793
Reputation: 143,702

Post » Wed Dec 14, 2016 6:55 am

Thanks a lot!
B
30
S
15
G
17
Posts: 137
Reputation: 10,873


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests