Keep running sub-event when parent becomes untrue

Get help using Construct 2

Post » Sun Nov 08, 2015 11:46 pm

Hi!

Is it possible to have a subevent run it's course even after the triggering parent event is no longer true?

I'm asking because have gotten myself into a situation like this:

When a player clicks on the "reset game" text, I check that the text of the text object is indeed "reset game" (because I use one universal text object for all texts).

However, before actually resetting, I would like to change the text to "Resetting..." in a subevent to indicate a change (so that the player gets visual feedback that the click registered).

The problem is that now the parent event condition is no longer true (text is no longer "reset game" but instead "resetting") and it seems like also the child event stops executing additional steps.

I know there would be other ways to solve this, but I'm interested in understanding Construct better. So is there any way of changing the text while still keeping the subevent running?
B
9
S
1
Posts: 97
Reputation: 715

Post » Sun Nov 08, 2015 11:52 pm

An event will not run if it's conditions are not true..

but at the moment you click the text, the conditions are true, so adding a wait action before the reset would solve this..
It would be no problem to show the text resetting.. during the wait..
(Instead of wait, you could also use a timer, ofcourse)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 09, 2015 12:01 am

Hmmm can't seem to figure that one out..

Here's the structure with which I'm trying to follow your suggestion:

-Touch on touched textUniversal
--textUniversal text is "Reset game" -->system -wait 1 seconds
----------------------------------------------------->textUniversal -set text to "resetting"
----------------------------------------------------->system -go to firstLayout

With this structure the text no longer changes, but the system doesn't change layouts either. I also tried other arrangements of events and subevents but so far I haven't come up with the right cocktail :/
B
9
S
1
Posts: 97
Reputation: 715

Post » Mon Nov 09, 2015 12:05 am

put the wait between the setting of the text and the goto layout..

the way you have it now setting the text and going to layout are done the same tick..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 09, 2015 12:36 am

Tried it like that now too, but then the new layout never loads.. Maybe what I'm trying is simply too difficult and I should switch my entire approach.
B
9
S
1
Posts: 97
Reputation: 715

Post » Mon Nov 09, 2015 1:18 am

It shouldn't be difficult, if the text is exactly what you wrote (no extra spaces, no capital G) and the layout you are trying to goto exists, that is..

I usually give textobjects an instance variable function to distinguish them from eachother..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 09, 2015 1:26 am

You are right, I made a simplified version of the project with only the necessary elements and it worked! I have to look for other causes of the problem in my main project. Thanks for your help!
B
9
S
1
Posts: 97
Reputation: 715


Return to How do I....?

Who is online

Users browsing this forum: YoHoho and 6 guests