# Match row connections

Get help using Construct 2

### » Wed Jan 23, 2013 6:18 pm

I am creating a game where I want to match a line of sprites from left of grid to the right side (and possibly vertically too but guessing that is really complex).

So for example a grid of 8 x 8 sprites where the idea is to connect the left hand side to the right hand side.

The main complexity i see though it the lines wont be straight they might start top left and end up bottom right to connect.

hope this makes sense, any suggestions on where to start would be much appreciated!

Edit: This is what I am trying to do, detect when there is a connection.

curv2013-01-23 20:40:03
B
7
S
1
G
1
Posts: 25
Reputation: 701

### » Thu Jan 24, 2013 1:36 pm

Ok, so I realised that I didn't really ask this question in the right way... So here is a little more info about what I am trying to do.

I have a series of sprites, 1 for each grid piece (like picture above) and want to detect when the first red blob and the second red blob are connected via the sprites i.e. the sprites are like pipes.

I have been looking into the A* algorithm, but I'm thinking maybe this isn't required!!

Any suggestions welcome!

curv2013-01-24 13:37:32
B
7
S
1
G
1
Posts: 25
Reputation: 701

### » Sat Jan 26, 2013 5:00 pm

I'm trying to understand exactly what you need but it's a little difficult. Basically, you want to find a way to determine whether or not the red dots are ultimately connected through the pipe network?

I'd suggest you give each pipe piece a boolean variable, like "connected" or something, that is activated under two circumstances: the pipe is adjacent to a dot piece; or if it's adjacent to another sprite that has connected set to true. Check each instance every tick to see if these conditions are met. If they're not, set connected to false.
B
56
S
15
G
10
Posts: 910
Reputation: 11,942