How do I create flexible wires in C3?

2 favourites
From the Asset Store
[C2] [C3] Support C3 build service and Android 14
  • The animations seem to be separate, moving on top of the wires. There's another current thread about moving along lines:

    construct.net/en/forum/construct-3/how-do-i-8/objects-move-along-curved-159494

    For the aliasing, that may just be a better graphic than the 8x16 sample I provided. Something with some gradient/alpha may be sufficient.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks. I will check it out.

  • I am using tiled background to create the wires and now I need to use some bezier curves to create the other wires with the connections between the plugs and the test probe(pen). I will need to create 4 connections (in this case, 4 lines).

    My question is whether I need to use 4 drawing canvas objects for this (since I have to clean the canvas every time I move the objects (pens/plugs) that create the lines), or if I can get the same result on a single canvas for the four lines, remembering that the objects can always be dragged and each time that happens the line has to be redrawn, without removing the others.

    I am using the same method of the IcticStep(https://www.construct.net/en/forum/construct-3/how-do-i-8/smooth-curve-150756)

  • If you don't have too many wires, I think you should be fine with redrawing several curves on one DrawingCanvas on every tick.

    You can do a quick test - draw the same curve say 20 times on every tick, and check CPU and FPS values in Debug Mode.

  • Actually, I have 2 wires. I understand the logic that you have suggested but I don't know how to do this. if you check the file on the link I posted, you will see that he clears each line to include the others. I even tried to create lines with other colors and clean the line according to the RGBA values but it didn't work.

  • This is really good and it is exactly what I need. Thank you!

    Is it possible for you to help me with this question?

    construct.net/en/forum/construct-3/how-do-i-8/create-simulator-without-159567

  • Yeah, I've seen that post, I don't know how to solve it. If each part was unique, it would be easier. But in your case you have multiple identical elements, which can be rotated and connected to each other in many different ways. So it's a difficult task.

    For example, can this be considered as correct solution?

  • Good question :) Actually, each part is unique (I intend to change the shapes for images later) and the correct thing would be to allow any combination, as long as the order is maintained, but if this is going to complicate a lot, we can restrict it to the circuit shape in the diagram, that is, the reproduction must be exactly the same, but it can be used as many wires as you want between the components. The most important thing is to make sure that the circuit is closed and that each component is in the correct order. What do you think?

    EDITED: The important thing is also that the ends are touching. I don't know if it would be better to use image points overlapping or a sprite on each end of the objects to check for overlapping/collision.

  • You can try checking objects one by one starting from the battery, for example. Pick one of the objects overlapping the battery. Let's say it's a wire. Then pick the next object overlapping the wire. As you move from object to object, save them to an array or a text variable. And then check if the sequence of the chain is correct.

    But this will only work for single loop diagrams like in your demo. I have no idea what to do with something more complex like this:

  • I think that it will not be necessary to build circuits as complex as this one.

    So should I use transparent small sprites in the objects' ends to detect this? For example, I would have to check what is at the A end of the battery. If it's the B end of a wire, I have to check what's on the A end of that wire. If it’s another wire, no problem, I will check what at another end of this wire, and if it’s the A end of the fuse, I check to see if there’s a wire at the other end, and so on...

    Would it be this? If so, how exactly do I do that? And how to adding this information in the variable (using append?) and then checking if the whole structure is correct? This is knotting my head.

  • You can define two image points on each object. Maybe snap objects to a grid when dropped, to make the points align perfectly. But I don't have a complete solution for you, like I said it's a difficult task, I only have a vague idea of how it may be done.

  • this would be a good case for using a linked node list. every component of the circuit would be a node in the list, each node would know the ID of the previous node and the next node. (each node would also know what job it is supposed do).

    if the last node is linked back to the first node, then you know you have a complete circuit - then it is just a matter of making sure you have the correct components and that they are in the correct order.

    pinning the components together is just a visual representation of the logical connection in the node list. The example RBuster linked to at the top of this thread most likely does something like this - you have to click on a connection, then on the scissors to break a connection before you can link in another component... you should only be allowed to make a connection between nodes that have a free connection available.

  • Thanks for the suggestion but I really don't know how to create a linked node list and even how to connect each wire/component on themselves to stick together like in the simulator that I shared.

  • each node would know the ID of the previous node and the next node

    AllanR It's a good idea! Since it's a closed circuit, you probably need to store just the next node ID. The difficult part will be checking the connection to the next node through wires.

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