For Each & Trigger Once Question

Get help using Construct 2

Post » Wed Oct 10, 2012 8:22 am

I have a problem combining these two conditions together.

Clicking anywhere creates an object with an AoE ring around it. I want the object to change colour when there are more than 4 objects in its AoE ring.

Been using

If AoE is overlapping Object
For Each Object
Trigger Once
> Add 1 to UnitCount (AoE instance variable)

Right now I can only get it to increase by 1 or overshoot entirely due to Trigger Once not working.

EDIT: How do you attach files -.-, I only see add hyperlinks / images / emails.Len2012-10-10 08:26:38
B
7
S
1
G
1
Posts: 37
Reputation: 1,128

Post » Wed Oct 10, 2012 1:37 pm

Hey Len,

Here is an example that hopefully will help out. You can get the idea of how the picking works and adapt it for your project.

http://db.tt/NPkcqk5Q

Move the left and right arrow to see the overlap number change.GenkiGenga2012-10-10 13:39:51
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Thu Oct 11, 2012 2:18 pm

If you need more help, you can attach the file by signing up for a free dropbox account, and uploading it to your folder, then sharing the link. (or some other file host, but most of us use dropbox)
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Thu Oct 11, 2012 7:11 pm

@GenkiGenga

Thanks for the example, it helped a lot. I was wondering if there was a way to simplify it further so that you can handle any number of overlaps.

Something like Pick Sprite2 instance n times, and update the overlap variable to = n.

@Nimtrix

Thanks for pointing that out. I came across drop box a couple of times on the forum and kept thinking it was forum feature that allowed you to attach small files haha. Got an account now :P
B
7
S
1
G
1
Posts: 37
Reputation: 1,128

Post » Thu Oct 11, 2012 10:51 pm

Is this what you want Len? I modified Genki's capx: OverlapCap2.capx
B
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Post » Fri Oct 12, 2012 2:29 am

No worries Len,

Thats nice Ramones, much simpler.
ImageImage
B
74
S
17
G
6
Posts: 1,039
Reputation: 10,605

Post » Sat Oct 13, 2012 7:18 am

@ramones: That's EXACTLY what I had in mind. Thanks!
@GenkiGenga: Ty again :)
B
7
S
1
G
1
Posts: 37
Reputation: 1,128


Return to How do I....?

Who is online

Users browsing this forum: linkman2004, Renfd, supreme676 and 21 guests