(solved)How do I do event that can happen only once?

Get help using Construct 2

Post » Mon Apr 20, 2015 11:44 am

The problem is here:

I have boxes that are dropping down on any object that is in family. When box is colliding with any of the family items, it will create dust particle cloud. But because of physics, sometimes the box is bouncing and creating actually multiple particle clouds which is not what i want. So how do i prevent the particle cloud appearing ever again except at the first time when box is colliding with something?
Last edited by sorbias on Mon Apr 20, 2015 6:30 pm, edited 2 times in total.
B
11
S
1
Posts: 63
Reputation: 658

Post » Mon Apr 20, 2015 12:32 pm

you might want to set a boolean variable on impact..

on collision
if boolean is not true
> create particles
> set boolean to true

I guess you should decide under what conditions you want the particle effect to reappear again..
maybe a timer, maybe when the box has stopped moving..
at that time set the boolean back to false to have the possibility of particles again.
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 Apr 20, 2015 12:41 pm

Huh, that's first time i ever hear about boolean variables. I need to do some research. :)
B
11
S
1
Posts: 63
Reputation: 658

Post » Mon Apr 20, 2015 6:28 pm

That worked very well and was an easy solution.

I did not know how to check if the variable is false, so i needed to check if its true and then change it to false, but that's not a big deal.

So my solution was like that:

on collision
box has boolean variable set true ->

Create particles
set boolean to false
B
11
S
1
Posts: 63
Reputation: 658

Post » Mon Apr 20, 2015 6:30 pm

To invert events right-click the event and select invert..
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


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 2 guests