How do I implement drag and elongate feature for Virtual Lab

0 favourites
  • 4 posts
From the Asset Store
A complete set of tiny sprites and tiles for your retro platformer game.
  • Hello guys.

    I'm trying to design a virtual laboratory for simple electrical experiments. I have two questions.

    1. How do I make the connecting probes of my multimeter responsive to being pulled to the position where they can measure values? I want the wires to increase in length when dragged and to return to their initial position when returned.

    2. How can I create a paint feature where users can draw a wire between set points and delete the wire afterwards?

    Here's a link to a screenshot of my project and also the .capx file [ space after https]

    https:// drive.google.com/drive/folders/0B5vJ-qVuz0QHZzRzVTZxTDZ6Y3M?usp=sharing

    Thanks very much.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The Multimeter Jacks are easy enough to implement using the built-in drag and drop feature of C2 or you can even manually create you own drag and drop feature using the LERP movement.

    Drawing the wire however is a whole other challenge.

    Since drawing is usually setting creating many instances of a circle or square sprite while dragging the mouse across.

    Meaning you would have to check collisions between many different instances and check if the ends are overlapping with the + and - Jacks.

    I can't go looking for the separate capx files you need right now but I suggest you start in the "How do I" section.

    You may want to redesign how you want to implement the wire feature for the earlier mentioned challenge.

  • Thank you for your reply. As far as I know, the drag and drop feature moves the whole sprite across the layout.

    Is there a way I could make it fixate it at one end and just increase the width between the two points?

    I could do without the draw feature now. I think the multimeter issue is probably more important.

  • Thank you for your reply. As far as I know, the drag and drop feature moves the whole sprite across the layout.

    Is there a way I could make it fixate it at one end and just increase the width between the two points?

    Yeah well you're not really going to drag the whole multimeter sprite across but just the jack sprite.

    This is what your multimeter looks like:

    So it's going to consist of several parts and not a single sprite.

    2 jacks, 1 Knob, 1 body, 1 number display

    By the way, I've just seen your capx and it's more complicated than I expected since you're involving a Bread Board.

    Plenty of points for each end of your components to snap on. But that makes drawing wires easier now since can use a single 'wire' sprite from one point to the next.

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