Set line's angle and width between dots

Get help using Construct 2

Post » Wed Apr 25, 2012 6:30 pm

I made a small project about creating sprite between 2 points. Now I need your help to set the width of this sprite and the angle from first dot to the second one.

.capxVladoss2012-04-25 18:31:10
B
38
S
15
G
6
Posts: 238
Reputation: 7,760

Post » Wed Apr 25, 2012 7:19 pm

I made some small changes, like changing the origin of the line to left, and using two objects instead of an instance variable (easier in this case, in my opinion).

My suggestion: LineBetweenDots.capx
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Apr 25, 2012 7:52 pm

[QUOTE=Nimtrix] I made some small changes, like changing the origin of the line to left, and using two objects instead of an instance variable (easier in this case, in my opinion).

My suggestion: LineBetweenDots.capx[/QUOTE]

Big thanks!!
If you do not mind, can you help me with something else?

I need to make this line not to get over some area like on the screen:



Any suggestions?
B
38
S
15
G
6
Posts: 238
Reputation: 7,760

Post » Wed Apr 25, 2012 8:16 pm

Hmm, I can't think of a way to make a line like image 2, if the player tried to do like in image 1. I'll think about it though.

Would testing to see if the cursor is inside the box be good enough?

Like this: LineBetweenDotsBox.capx
B
27
S
8
G
8
Posts: 903
Reputation: 8,452

Post » Wed Apr 25, 2012 9:14 pm

Here's another approach to clipping a line to a box:
http://dl.dropbox.com/u/5426011/examples10/lineClip.capx

Also an alternative solution would be to use math to find the intersections between the line and the sides of the box.
B
79
S
24
G
54
Posts: 4,747
Reputation: 40,757

Post » Fri Apr 27, 2012 4:51 pm

[QUOTE=R0J0hound] Here's another approach to clipping a line to a box:
http://dl.dropbox.com/u/5426011/examples10/lineClip.capx

Also an alternative solution would be to use math to find the intersections between the line and the sides of the box.[/QUOTE]

Check your mail, please :P
B
38
S
15
G
6
Posts: 238
Reputation: 7,760


Return to How do I....?

Who is online

Users browsing this forum: Kagubro, Yahoo [Bot] and 22 guests