Instances affecting other instances

0 favourites
  • 7 posts
  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Post a .capx

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

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

    Thanks

  • 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.

  • 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,

    cH

  • 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:

    scirra.com/tutorials/361/understanding-uid-iid-health-cards-and-rocket-smoke-trail

    Hope it helped.

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)