How to create an arrow

For questions about using Classic.

Post » Sat Dec 26, 2009 1:43 am

Hi there

So i am trying to make a really simple game using the physics behaviour.
Basicly the goal is to bump the other players pads out of the layout.
Its only to understand the physics and all that. (Please download the file to understand the game)

So what i'm trying to do is when i click a pad there will be no movement until i press the mouse button again. When i click a pad there should be a arrow point from the pad to the position of the mouse and be maximun of some length(few cm). This arrow represents the speed of the pad when you click again.
I dont know how to make the arrow so it will be streched to the position of the mouse, should i use the selection box behaviour ?

Anyways you can see what i am talking about here [url:x1q8rzv3]http://internet.is/eski/buttongame.cap[/url:x1q8rzv3]

Thanks.
Sigurgeir
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Sat Dec 26, 2009 1:54 am

Off the top of my head, you could try drawing a line from point A to point B, and use a triangle shaped sprite (the arrow head) and tell it to sit on the end of point B, with an angle facing the mouse. That "might" work?
B
3
S
2
G
3
Posts: 628
Reputation: 2,531

Post » Sat Dec 26, 2009 11:20 pm

And set the hotspot for the arrowhead to its tip.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Dec 27, 2009 8:40 pm

Yeah.. thats not working like i want. I get a line and a arrow on the end pointing random directions..
To bad i cant get the angle or direction on the line, then it wouldnt be any prob.
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Sun Dec 27, 2009 8:42 pm

Or even if there was a way to change the image that the "line object" draws.. that would be awesome.. :D
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Mon Dec 28, 2009 5:33 am

[quote="eski":ydlu5unv]To bad i cant get the angle or direction on the line, then it wouldnt be any prob.[/quote:ydlu5unv]
line.angle would be the line's angle.
This is the angle you would put in the arrowhead's angle.

Don't just give up on the first try
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Mon Dec 28, 2009 9:28 am

is this what you mean?:
[url:w8xcd11l]http://dl.dropbox.com/u/1013446/arrow.cap[/url:w8xcd11l]
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Mon Dec 28, 2009 11:23 am

I dont understand, there is no Line.Angle that i can use...

Lucid, construct crashes when opening the file, what version do you have ?
B
7
S
1
G
3
Posts: 66
Reputation: 1,651

Post » Mon Dec 28, 2009 1:17 pm

[quote="eski":25mcxi9l]I dont understand, there is no Line.Angle that i can use..[/quote:25mcxi9l]

You can calculate the angle of the line with this expression:

[code:25mcxi9l]angle(Line.StartX, Line.StartY, Line.EndX, Line.EndY)[/code:25mcxi9l]

http://dl.dropbox.com/u/529356/linearrow.cap

This .cap and Madster's both use v0.99.7
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Dec 28, 2009 6:13 pm

and i believe my cap was 99.7 as well
you8 dont need the line plugin
i think its just making it more confusing for you
the cap i made is simple

draw an arrow sprite facing toward the right
with the hotspot on the left


always
---sprite-set angle towards position-mousex,mousey
---sprite-set width to distance(.x,.y,mousex,mousey)
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests