[Solved] How do I create a chain connection?

  • Hey guys, how are you?

    I try to create a chain connection, but i think something missing.. : -(

    Please take a look to capx file: http://odiusfly.com/chain_v1.capx

    Any help? Thanks! : -)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Anyone?

  • It seems to work just fine, as long as you don't break the chain while istouch = 1

    You don't have any events/actions to change the animationframe while istouch = 1

    This can probably be solved with a simple else event..

  • Did you try "else" method? I don't think "else" only can fix all this. I think it depends some extra code, but I have stuck.

    "Else" would be work if we have 2 objects only for example. If you read carefully inside capx, i said how i want to work. By the way, thanks for your reply.. : -)

  • I would not use "overlaping" to determine the connection or not.

    If your game doesn't expect more than 4 instances in a row, use an instance variable (or the IID) to determine which "box2" your are testing, and depending on the state of the previous instance (either "connecting" or "cut") you know what color to apply to the current instance.

  • Thanks for your reply!!! Do you check my capx? You will see inside what exactly i need.

    If you have free time, can you do a fix version? Big Thanks!

    Note: This is a sample. At the future i want to use more shapes, the important for me is, all shapes to connected (to be green color) by the first object.

    If the first object is set off, then all objects to be red. Think a "line" for example, starts from 0 and end to 10. If disconnect the number 3, the numbers 1-2 will remain green and the numbers 3-10 will be red. Hope you understand..

  • Change the condition in event 5 from "X Box1 is overlapping family1" to "every tick" and then move the event to be above event 4.

    That fixes it in the situation you have but it probably will fail later on in some situations. Adding a "repeat 10" condition to the top of event 6 would be a quick fix, although not the most efficient.

  • Thank you for your reply but is not working.. So to create a logical line like a said above is too difficult?

  • It worked when I did it, so unless I wrote it down wrong, I don't know what's amiss.

  • Thank you for your reply but is not working.. So to create a logical line like a said above is too difficult?

    R0J0hound 's solution seems to work ...

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

  • R0J0hound, sorry when i was said not working, i don't mean your code.

    grigrizljac, thank you but is not working the method i need.

    Please guys see the version to understand, i add another box: http://odiusfly.com/chain_v1_fixed2.capx

    <img src="{SMILIES_PATH}/icon_exclaim.gif" alt=":!:" title="Exclamation"> As Kyatric said, maybe instance variable or something to help. But it's an idea.

    Maybe something to detect the previous box if has green color for example, and to give to the new box a green color too. But always to work like a chain. If something disconnect to return the red color. I don't know, I have stuck.. <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    NOTE: Connect all boxes, all good! Now, disconnect the box 3. I don't want to remain green the box 4 and box 5.

    As i said above think a line, a cable. Think box 1 (Basic) as switch and the last box (in this example: box 5) as a lamp. Need to be a logical connection.

    BIG THANKS!!!

  • Any progress? Thanks!

    Please don't bump your own thread after only 3 hours.

    It is acceptable to bump your own thread after 24 hours if no response has been forthcoming.

    Please remember that users come from many different time zones, so a little patience is required.

    zenox98 Yes ok, sorry.

  • Any progress? Thanks!

    Please don't bump your own thread after only 3 hours.

    It is acceptable to bump your own thread after 24 hours if no response has been forthcoming.

    Please remember that users come from many different time zones, so a little patience is required.

  • every tick

    --- box2: set animation frame to 0

    box2: is overlapping box1

    --- box2: set animation frame to 1

    repeat 10 times

    box2: animation frame = 1

    box2: is overlapping family1

    --- family1: set animation frame to 1

  • R0J0hound YOU 'RE THE MAN!!! : -) THANKSSS!!!

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