Instances affecting other instances

Get help using Construct 2

Post » Mon May 13, 2013 12:52 am

Hey everyone, I have been working with C2 for about 3 weeks. I have all but the main action for my game. I have the menus, graphics, etc.

The game is similar to the old 'Lights Out' game. You press a graphic and it changes color. I have that working fine. But when the image is pressed images around it also changes color. Each image has its own set of effected images. For instance you have a 3 by 3 grid of images.
When image 1 (top left corner) is pressed, image 2 and 4 both change. If image 2 (top center) is press, image 1, 3, and 5 change. The images are created dynamically on 'layout start' event with nested loops. There are no collisions, movement, a very simple game.

Ultimately I would prefer to have a single formula that would check for images based on the touched image's location in the grid.

I have gone through several tutorials, the manual, and the forums to find an answer. No luck.

cH
B
5
Posts: 6
Reputation: 264

Post » Mon May 13, 2013 2:19 am

Post a .capx
B
10
S
3
Posts: 102
Reputation: 1,888

Post » Mon May 13, 2013 2:48 am

It took me a few minutes to figure out how to make a capx. lol

https://dl.dropboxusercontent.com/u/78185180/CL2.capx

Thanks
B
5
Posts: 6
Reputation: 264

Post » Mon May 13, 2013 4:00 am

@codeHammer

I've tried your game from Easy to Insane and I don't see the issue you are talking about. Each tile changes colors by itself and doesn't affect adjacent tiles.
B
10
S
3
Posts: 102
Reputation: 1,888

Post » Mon May 13, 2013 11:42 pm

Well the shapes/difficulty has not been implemented. As far as the tiles effecting other tiles, that is the effect I am trying to create. Once I get that going I can finish it out. Because that is the basis for the entire game, without that functionality the game is useless. I just need a nudge in the right direction.

Thanks,
cHcodeHammer2013-05-13 23:43:20
B
5
Posts: 6
Reputation: 264

Post » Tue May 14, 2013 2:21 am

You could check with "overlapping by offset" or making an array (matrix 2D), or, making an invisible tiled background, checking every cell (this is the same matrix, but visually made), and doing the code by checking their order.

More about of how indexing sprites:
https://www.scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail

Hope it helped.
ImageImageImageImageImageImage
B
93
S
19
G
12
Posts: 1,192
Reputation: 18,301

Post » Tue May 14, 2013 2:41 am

Ok thanks. I thought of using the array but couldn't figure out how to access the related instance. But I think I may have it now. Just wasn't sure which direction to go in.

Thanks again,

cH
B
5
Posts: 6
Reputation: 264


Return to How do I....?

Who is online

Users browsing this forum: NRABrazil, PixelatedTrip and 29 guests