How do I make connecting cable between 'Button' and 'Bulb'?

  • Hey guys,

    I making the simply platform / puzzle logic game. But I was stuck at a standstill...

    I have no idea, how to make a "cable" - connecting chain between 2 or more objects which is builded from the same parts like simply rectangular section. For example, i have 'rectangle' named 'cable', 'the bulb' and the 'button'. But there is a path of 'cable' sections (5 or more duplications of cable) which makes a chain. So, I can't make just: "Button is overlapping cable" & "Cable is overlapping bulb" because it will make only 'remote' connecting , so even if chain of 'cables' will be not complete (like on the image below) the bulb will still work, because of condition "cable is overlapping bulb".

    So is there just a simply method to make that chain in C2?

    Can anybody help me, explain that method, or make simply example in C2?

    I would be very grateful!!

  • Basic idea is using flood-fill method to check whether any piece is part of the cable or not started from initial tip. Yes it use overlapping test to achieve that kind of mechanic.

  • alextro, can you explain a little bit more how that flood-fill method works, or where can i find tutorial for this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the chain parts are to be placed on a predefined path, you can make a variable which can count how many chain parts are placed,

    if all 5 are placed correctly + its overlapping button + its overlapping bulb = Light the bulb

    And if any of those 3 conditions are not true, it wont light up

  • Thank you, this is not bad solution, but not perfect.. If i want to make 50-70 different levels so i have to make 50-70 different paths and 50-70 conditions to these.. so its not exactly what i want to do. I want to make something like "modules" which can i add to random levels, when i'll design them, and they'll work with the same conditions - just flexible modules, which can help designing levels and build them very easy.

    So if I could make 'clever' chain, checking all connectivity - so i'll be able to make different levels using the same assets, which are "programmed" at beginning.

    Im not sure if all these stuff is understanding

    If you know about Lego power functions - so its something like that

  • Always solvable with math and an array & a grid to reduce the possibilities.

    But, you said overlapping dont work so i used overlapping.

    https://www.dropbox.com/s/k2dcuymlcsxbh ... .capx?dl=0

    Only moves on the grid with the tile = 1 are allowed. So, predefined paths are (boring) easy to define in the layout.

  • flood-fill example:

  • 99instances2Go - unfortunely I cant open your file, because I'm using old version r209 (neweer versions doesn't work on my laptop.. i don't know why, there is error..) So i cant see what you've done

    alextro, its perfect what you did I tested "toggle disable" to the action - 'peg destroy' to better understand how it works , and for "Repeat 10 times" condition - so its just a difference between gradually filling, and immediate filling, right?

    And i dont know how work condition: 'For "" from 0 to 3' , can you explain me that in easy way xD ?

    I will be grateful, because if I want to use that mechanic, I think, i should understand all of the conditions and actions.

    I will test that in my game

    Thank you very much

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