Touch function and messages sequence

Just started using Construct 2? Post your questions here

Post » Mon Dec 05, 2016 10:03 pm

Hi,

(sorry it's my second post today but I have 2 distincts problems I can't resolve...)

I'm trying to make appear a sequence of sentences with the Touch function.

For example : Sentence_1 - The player has to click on "Next" sprite to make Sentence_1 to disappear and to make appear the sentence_2. etc.

But when I do that, whatever I use "On touched", "Is Touching", "On Tap object" (I tested all of them!!) it doesn't works correctly and ALL my sentences are disappear.

Here precisely what I did in my events (my sentences are in Text object) :
(By default, all my Texts are invisible except the first)

EVENT 1 :
Text Sentence_1 is visible ........................................ Text Sentence_1 - Destroy
Touch - On touched "NEXT"...................................... Text Sentence_2 Set visible
System - Trigger Once

EVENT 2 :
Text Sentence_2 is visible ........................................ Text Sentence_2 - Destroy
Touch - On touched "NEXT"...................................... Text Sentence_3 Set visible
System - Trigger Once

EVENT 3 :
Text Sentence_3 is visible ........................................ Text Sentence_3 - Destroy
Touch - On touched "NEXT"...................................... Text Sentence_4 Set visible
System - Trigger Once

etc, etc, etc....

But when I test it, if I touch the "Next" sprite, all my sentences are destroying at the same time. What I'm doing wrong ?

Or is it a bug with the Touch function when we test it on construct 2 via computer ? It's an app for Mobile so I don't have the choice to use "Touch" here... :(

thx for your help :)
B
19
S
7
G
1
Posts: 38
Reputation: 1,911

Post » Mon Dec 05, 2016 10:58 pm

Have On touched first, then sub-event S1 is visible Else S2 is visble Else... That is the bester way to deal with this.
ImageImageImage
B
71
S
21
G
232
Posts: 3,696
Reputation: 129,868

Post » Tue Dec 06, 2016 12:51 pm

Ok I will try this, thank you very much :)
B
19
S
7
G
1
Posts: 38
Reputation: 1,911

Post » Tue Dec 06, 2016 1:23 pm

On Touched Object is a trigger who works only once, so, you can't use On Touched Object and Once While True, they are the same with the add of the touch condition.

You can solve your problem by inverting your condition events, check the last by first and so on or use the sample I made, but you'll need to change your logic.

https://www.dropbox.com/s/ea4upippd637y ... .capx?dl=0
Image
B
107
S
24
G
18
Posts: 1,362
Reputation: 22,772

Post » Tue Dec 06, 2016 4:17 pm

Blackhornet, your solution worked to me, thx again :)

TelleS0808, thank you to made a capx specially for me, I have an older version than you so for now I can't open it, but I'll make an update today to be able to open it, and see finally which solution is the best.
B
19
S
7
G
1
Posts: 38
Reputation: 1,911


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest