How to create an arrow

This forum is currently in read-only mode.
  • 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 http://internet.is/eski/buttongame.cap

    Thanks.

    Sigurgeir

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

  • And set the hotspot for the arrowhead to its tip.

  • 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.

  • Or even if there was a way to change the image that the "line object" draws.. that would be awesome..

  • To bad i cant get the angle or direction on the line, then it wouldnt be any prob.

    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

  • is this what you mean?:

    http://dl.dropbox.com/u/1013446/arrow.cap

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

    Lucid, construct crashes when opening the file, what version do you have ?

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

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

    angle(Line.StartX, Line.StartY, Line.EndX, Line.EndY)[/code:25mcxi9l]
    
    [url=http://dl.dropbox.com/u/529356/linearrow.cap]http://dl.dropbox.com/u/529356/linearrow.cap[/url]
    
    This .cap and Madster's both use v0.99.7
  • 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)

  • and i believe my cap was 99.7 as well

    Oops, hehe sorry... I meant lucid

    Same difference v<img src="http://www.scirra.com/forum/images/smilies/icon_smile.gif">v

  • Allright.. that worked out great.. Just like i wanted it

    I thought the angle of the line would be some expression that was build in but no prob with the expression you came with..

    I like the way lucid did it also.. Capped the maximun length of the sprite.. Didn't understand the formula thought.. The same formula doesn't work for the line plugin.. it just makes the line fat

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)