How do I cancel a Wait Loop?

Just started using Construct 2? Post your questions here

Post » Sat Apr 18, 2015 12:46 pm

Hi Everyone!

So i'm working on a little Game and here's the situation:

I'm having a Variable that if turned on initiates a Wait Action of three Seconds. If the three Seconds are up, another Action should happen but if the Player reacts DURING the three Seconds, again, another Action will happen.

I kinda got it working with Subevents, but the Problem is, when i take the Action, the Game will still wait until the three Seconds are up to change my Animation Frame etc.

Maybe to make things clearer: the Game is about a Guy trying to sleep but being tormented by a Mosquito. You only hear it in the Dark and if it sits on your Nose and you don't react quickly enough, you get stung. So the player has to turn on the Light in Time :) Everything works great so far, except the Timing bit, where you have to turn on the Light during the short Timeframe that the Insect is on Contact with you.

So the Event basically sais: if the Mosquito Variable is onNose, the System is to Wait for three Seconds. If the Player switches the Light "On", the winning Animation is played and the Layout restarts. If the Player doesn't react, the losing Frame is set and the Night Layer is disabled and the Lightswitch is turned on. You then see the Losing frame for three Seconds and the Layout restarts... Hope that makes kinda Sense :S
Thanks for your help :)

Image
B
14
S
5
G
1
Posts: 82
Reputation: 1,191

Post » Sat Apr 18, 2015 1:01 pm

Instead of the wait action it might be better to use the timer behaviour.
For example - give the bed the timer behaviour.

onNose =1
trigger once
> bed - start timer Nose

bed - on timer nose
> play losing frame

onNose = 1
Light = "On"
>bed - stop timer
>Win!
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 » Sat Apr 18, 2015 1:04 pm

There is also the wait for signal, but in this particular case I don't think it's easier to implement.
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 » Sat Apr 18, 2015 1:08 pm

Thank you! I wasn't familiar with Timers yet. I'll go over the books again but i'm sure it'll work out :)
B
14
S
5
G
1
Posts: 82
Reputation: 1,191

Post » Sat Apr 18, 2015 1:45 pm

Hm, weird. I think i did everything correctly and the Light On works great now but after the three Seconds expire nothing happens... I tried around with taking out the "Trigger Once" Condition but it doesnt seem to make a difference...

Any Ideas?

Image
B
14
S
5
G
1
Posts: 82
Reputation: 1,191

Post » Sat Apr 18, 2015 1:51 pm

having these events as subevents of a trigger once event won't work.

I would make the trigger once - a subevent and have the start timer action on that subevent.
Than making the on timer a separate event should be enough.
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 » Sat Apr 18, 2015 2:33 pm

I think i'm too stupid... I tried every possible Combination including the one you told me but it still won't work...

Sometimes its kinda confusing for me to know when to use Subevents and when to use normal Events. Another little Bug i encountered is, that my Mosquito Trigger Spawnsnew Sprites everytime i turn on the Light. When i set another Condition for either a Variable or that the Mosquito must be OffScreen it doesn't work either...

It's pretty hard to explain so i also attached my capx File if anyone cares to take a look at it. Sorry for the crappy Graphics, i'm only prototyping ;)

https://drive.google.com/file/d/0Bwu0b_8ZTavBdlNYcFcxQXNPMmM/view?usp=sharing

And here's my complete Event Sheet...

Image

As well as how this whole thing looks... The red Stripe on the right is the Trigger that makes the Mosquito sit on the Nose. The Timer only started working after i put it under the "On Collision" Event with this Trigger which maybe makes sense though...

Image
B
14
S
5
G
1
Posts: 82
Reputation: 1,191

Post » Sat Apr 18, 2015 2:39 pm

If noone beats me to it I'll look into it later tonight..
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 » Sat Apr 18, 2015 2:49 pm

I just found the Error and i'm officially an Idiot haha.

I set the On Nose Variable as an Instance on the Mosquito... Which is of course pointless if i'm destroying it duh... Now i set the Variable as a Global again and it works ;) I also fixed the Issue with the continuous Spawning... I'm learning it seems :)

THANKS!!!!!
B
14
S
5
G
1
Posts: 82
Reputation: 1,191

Post » Sun Apr 19, 2015 9:26 am

Okaaay i'm back again. The basic functionality works although i'm having a new Problem with the Spawning of the Mosquito.

I included a Wait Random Conditionq that should only happen when the Light is off, which works. If i switch the Light on and off multiple times though before the Object has been spawned, i get a whole Army of Mosquitos flying.... I only want this to happen ONCE and never have more than one Mosquito going on...

I updated the Capx File too... I think i'm at the End of my Knowledge here, maybe there's a better way to do this :S

Any help is greatly appreciated!!!

Image

https://drive.google.com/file/d/0Bwu0b_ ... sp=sharing
B
14
S
5
G
1
Posts: 82
Reputation: 1,191

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest