How do I draw a line that follows the mouse?

Get help using Construct 2

Post » Tue Aug 26, 2014 9:47 am

Hello,

I'm trying to make it so that the line will stretch and follow the position of the mouse until it touches another hexagon. The line will then stick itself to the hexagon but still follow the mouse until the button is released. Kind of like how you unlock your phone by connecting the dots.

Any help will be greatly appreciated!
B
3
Posts: 5
Reputation: 185

Post » Tue Aug 26, 2014 10:05 am

You can use R0J0hound plugin call Canvas and draw path or anything you want. Give credit to R0J0hound if you do use his plugin
B
257
S
42
G
15
Posts: 1,992
Reputation: 41,415

Post » Tue Aug 26, 2014 10:17 am

Thank you so much for replying. I just checked out R0J0's canvas, but I'm not sure if I can use that to achieve what I want.

I'm trying to do something like this: (sorry they took down my youtube link...)

Something like the game Line Zeta, Thousand Memories or Pokopang

Where the line connects from one hexagon to another and links together, but before it does so it follows the mouse/finger.
B
3
Posts: 5
Reputation: 185

Post » Tue Aug 26, 2014 10:25 am

Add a variable to your line
On click > Create line
Left button is pressed & line.variable = 0 > Set line width to distance(Line.X, Line.Y, Mouse.X, Mouse.Y).
Anything after the mouse on hexagon is doable too, on mouse hovering hexagon > set line.variable to 1 and set line width to distance between line and hexagon, then create another line etc..
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Tue Aug 26, 2014 10:45 am

Too much talking, here is the example capx.
You do not have the required permissions to view the files attached to this post.
B
22
S
9
G
7
Posts: 421
Reputation: 6,543

Post » Thu Aug 28, 2014 3:01 am

Oh my god this seems like exactly what I need! I'll give it a try immediately thank you so much Sisyphus!
B
3
Posts: 5
Reputation: 185


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests