AllanR's Forum Posts

  • The way it is now the wires need to be there, they just don't factor into determining if the circuit is correct or not. The same thing would apply to testing voltage - you would have to know what each component does (adds or subtracts from what it inherits from the previous component). For wires, they would have no effect other than passing on what voltage they receive (if any).

    will you need to have more than 1 battery? I would need to know what effect each component has on voltage passing through it - Fuse, how much before it breaks; resister, how much it resists; battery, how much it provides...

  • all your enemies should be in a family, and the health variable should be on the family. Then one event can pick enemies with health 0. And then a sub event can do a for each enemy to call the appropriate death sequence (which can also be set as a family instance variable).

  • I just updated the previous file - it now has a global string of what components are required in the circuit. So you can change that for different circuits.

    Every time it checks connections it starts with the first component in the Answer variable and checks if it is in a circuit that loops back around to that first component, and checks if the circuit has the correct components in the correct order. It doesn't include wires in the solution, and doesn't check if components are wired in frontwards or backwards...

  • it shouldn't be hard to have it check a correct answer for different circuits once the linked list of components is properly maintained... one thing that is probably significant is how a component is wired in. Things like batteries and resisters would have to be connected the correct way (not reversed). Right now I changed all the components so that imagepoint 1 is on the left and imagepoint 2 is on the right, so that could be considered positive and negative respectively. I have some ideas on that and the animation, but wont have much time today...

  • I just updated the file, so re-download it from the previous link.

    I added wire cutters - if you drop them on a connection, it breaks it.

    I also added a connection value field. Component connections have a value of 1, wires a value of 0. When you attempt to make a connection, the total value must be less than 2. So, that means components can't be directly joined together. (although I think that should be ok, and the example you linked to allows those types of connections.)

    I didn't do anything about the double battery connection - if the connectors line up, it allows the connections. at least now you can cut one... it would be hard to tell which of the two the user wanted to connect.

  • well, that turned out to be a much deeper rabbit hole than I expected...

    I made each component a "Node" (renamed Family1 to NodeFamily), and after looking at the Circuit project at the top of the thread decided we needed to add an Connector object as well, because you can drag Nodes or you can drag the connection point.

    so, after a lot of debugging, infinite recursive loops, and strange side-effects, I think I have the connecting of Nodes working pretty well. Right now the Connector objects know how things are joined together, but the Nodes themselves don't build a proper linked list that would be required to test the logic of the circuit...

    drag Nodes or connectors until they overlap (the connectors will turn blue), when you drop the object the connection is made. Right now there is no way to break a connection. And each connector can only make one connection (unlike the example Circuit project linked at the top). My code needs a lot more comments to be readable! and it probably could be cleaned up now that it is mostly working.

    https://www.rieperts.com/games/forum/NodeConnect.c3p

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

  • I guess you can do it all in script, but if you have multiple instances of Text you would have to loop through all instances to pick the instance you want to update...

  • TEXT objects in C3 are custom objects rendered on the canvas, not html elements, so as far as I know, you would have to send the prompt value to the event sheet using a local (or global) variable...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • in the properties section on the left, you can disable Default Controls to make a player object not respond to the arrow keys. You would also do this for NPCs, enemies...

  • ok, I used the image of the slider, and Dop's qarp calculation. But instead of three sprite objects to define the curve, I added image points to the slider graphic where the A, B, and C boxes would go to make the curve work. I also clamp the touch X value so the circle part of the slider can't go past the ends.

    if you drop the circle and it is not close enough to the end point, it resets back to its starting position.

    https://www.rieperts.com/games/forum/Slider.c3p

  • it is a lot harder than you would think...

    this is an old sample I made a couple years ago in C2. It doesn't seem to work with the C3 runtime, so if you load in into C3 you have to go into the advanced project properties and choose the C2 runtime.

    the project links a bunch of dots into a line and forces the object you drag to follow the line. the more dots you add. the better the curve would look.

    https://www.rieperts.com/games/forum/DragAlongLine.capx

    there are other ways to do this - if you have an equation for the line, then you can calculate a point anywhere along the line. Or if the curve is a segment of a circle you can use sin and cos to calculate where the blue square should be...

  • my file doesn't use Canvas - it uses an old ROJOhound function that connects line segments.

  • another option would be to use bezier curves... not as flexible as physics but might be easier to drag around and stretch as needed. See this old demo I made a while ago. the curve on the left allows you to just drag one of the end points. The curve on the right needs the blue dots to be moved to create the curve you want.

    https://www.rieperts.com/games/forum/Bezier_Curves.capx

  • oh, Dop2000 beat me to it...

    you were very close. instead of setting the angle and distance to Sprite.X, Sprite.Y you need to set those to the previous Sprite2 instance.

    I set the speed of Sprite2 to -1200 so you don't have to after creating each instance, and I changed the origin slightly to get a better line. Plus if you press the space bar it stops the motion so you can see the line better.

    https://www.rieperts.com/games/forum/sin_line.c3p