connect sprites with lines

Get help using Construct 2

Post » Mon Nov 25, 2013 11:22 am

I have a very simple setup where i want to connect 2 dots with a line, i have everything working properly (angle, position, .. ) except the width is set to the distance and it scales from te center (not from the origin).

So my question is how do i make sure the line does not scale in both direction but rather from the origin towards the 2nd sprite.

Tx in advance!
B
4
Posts: 9
Reputation: 220

Post » Mon Nov 25, 2013 11:27 am

Set the origin of the line sprite to the left.
set position to sprite1.x,sprite1.y
set width to distance(sprite1.x,sprite1.y,sprite2.x,sprite2.y)
set height to 2(or 3, or 4, or whatever height you want)
set angle to angle(sprite1.x,sprite1.y,sprite2.x,sprite2.y)
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 25, 2013 3:08 pm

Thanks that solved it!
B
4
Posts: 9
Reputation: 220

Post » Tue Mar 25, 2014 5:54 pm

Sorry to reopen this thread, but my doubt is similar: how can I connect 02 instances of the same sprite?
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Wed Mar 26, 2014 9:48 am

@LittleStain: Could you help me with this?
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058

Post » Wed Mar 26, 2014 9:52 am

If you want to connect two instances of the same sprite, you should make it very clear which two instances you want to connect. This is a question of picking the right instance in your events.
There are many ways of picking, so it all depends on what you are trying to achieve.
Once the second sprite is picked you can reference it by UID inside the eventsheet.
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Wed Mar 26, 2014 10:10 am

Could I use a variable to identify each instance too, right? But would be more practical to use the UID?

Using your example, can I include the UID after the name of the sprite (sprite.uid (n). X)?

Thanks
B
74
S
13
G
4
Posts: 1,005
Reputation: 8,058


Return to How do I....?

Who is online

Users browsing this forum: valefor and 23 guests