Trigger events once each time condition applies

Get help using Construct 2

Post » Wed Jul 24, 2013 11:59 pm

Hello there ,

I'm looking for someway to trigger a list of actions (for that instance) each time a condition applies to that instance but only once

Here's what I got ...

I have a Block Object , and a (imaginary) grid where the block snaps ... and each time an instance snaps ( I have the snapping condition , I need to trigger some events for that instance( once )

So , Bigger explanation

I need to trigger some actions (for that instance) once each time an instance meets a condition , taking note that I already have that condition


Distance_to_snap = 0.3

unfortunately , it only works when all instances move and snap

So Briefly,

When an instance snaps , I need to pick it and trigger some events (ONCE) for that instance , what conditions could do the trick ?

Cheers !
B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436

Post » Thu Jul 25, 2013 12:51 am

Fixed !
B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436

Post » Thu Jul 25, 2013 2:03 am

Hey, I'm working on something similar.

What would be the solution? :)

Basically, trying to set up a repeating flag (global variable) trip every X pixels to trigger a set of events once.

Problem is I'm not a math whiz.

It would work off scrollx.

So basically every X pixels scrollx rolls right for example, the same flag goes off.

Think it could be done with Trigger Once, then resetting the global variable flag trip to off at the end.

Just having trouble conceptualizing the math/formula.
B
27
S
15
G
10
Posts: 185
Reputation: 7,962

Post » Thu Jul 25, 2013 3:08 am

I used a boolean

Setting it to true and resetting it to false when the events triggered
B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436

Post » Thu Jul 25, 2013 6:23 am

The original solution des not work because the 'System -> Compare two variables' condition does not pick any objects, thus any actions affect all of them.
B
24
S
9
G
7
Posts: 756
Reputation: 7,292

Post » Thu Jul 25, 2013 3:26 pm

@vee41 ,

You are right , so I made a boolean that picks objects that are moving and thus instances that will snap soon , and made it a condition for that event , and woosh , problem solved
B
41
S
17
G
17
Posts: 2,247
Reputation: 17,436


Return to How do I....?

Who is online

Users browsing this forum: Jhorbam and 9 guests