How do I implement drag and elongate feature for Virtual Lab

Just started using Construct 2? Post your questions here

Post » Tue Apr 04, 2017 11:04 am

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.
B
5
Posts: 4
Reputation: 231

Post » Tue Apr 04, 2017 11:17 am

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.
Image Image Image
B
31
S
11
G
27
Posts: 748
Reputation: 17,093

Post » Tue Apr 04, 2017 11:40 am

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.
B
5
Posts: 4
Reputation: 231

Post » Tue Apr 04, 2017 1:53 pm

KayMagnum wrote: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:
Image
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.
Image Image Image
B
31
S
11
G
27
Posts: 748
Reputation: 17,093


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests