How do I draw a dotted line?

0 favourites
  • 4 posts
From the Asset Store
Connect the dots in the correct order and complete the shapes!
  • Took a break from C2, now I'm back and seem to be blanking on something that sounds easy enough.

    So, how do I draw a dotted line from point A to point B? I'm using it to indicate waypoints for an object so the dotted lines will vary in length, but obviously the scale of the dots in the line shouldn't change. I made a passable imitation using a Tiled Background object, problem is that it has no image point so it looks off-center. Not too noticeable with thin lines but gets progressively worse the thicker it gets.

    Anyway, is there a way to do this?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Just thinking out loud here.

    I would make a sprite for the size dash line you want.

    Then use set animation and create that sprite on a path using an event.

    Set position "Dash" on angle or to object.

    You will need to find each position for the dash to appear next and set the timing with a wait command probably.

    It works in my head lol!

  • Took a break from C2, now I'm back and seem to be blanking on something that sounds easy enough.

    So, how do I draw a dotted line from point A to point B?

    im guessing you are talking not about a sprite like above,

    use for"x"

    from your x starting position

    to target x position

    for"y"

    from your y starting position

    to target y position

    .

  • Hmm, I suppose I could use a sprite and loop to draw the lines, but in that case I'm not sure how to make the lines "dynamic" if need be. For example if the line is between points A and B and point B is moving perpendicular to A, the line would need to change in length/angle.

    For now I'm mitigating the off-center effect of the Tiled Background by playing around with image points, I was just wondering if there's a better way to do this.

    Just to be clear I know how to draw the line, I just want the line to be dotted instead of solid.

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