GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2016-09-17 12:25:15

DJ Coco
Member
Registered: 2016-09-13
Posts: 5

draw_line_dotted_width(x1, y1, x2, y2, w)

Expand/// draw_line_dotted_width(x1, y1, x2, y2, w)
/// GMLscripts.com/license

var x1 = argument0, y1 = argument1, x2 = argument2, y2 = argument3, w = argument4;
var dist = point_distance(x1, y1, x2, y2) * 0.05; //Random factor to scale it to an appropriate length

for (var i = 0; i < dist; i++) {
    xx[i] = x1 + (x2 - x1) * (i / dist);
    yy[i] = y1 + (y2 - y1) * (i / dist);
}

for (var i = 0; i < dist - 1; i += 2) {
    draw_line_width(xx[i], yy[i], xx[i+1], yy[i+1], w);
}

Offline

#2 2016-09-21 09:05:46

gnysek
Member
Registered: 2011-12-29
Posts: 36

Re: draw_line_dotted_width(x1, y1, x2, y2, w)

draw_line_dotted_width(5,5,100,30, 1); - draw two lines for me, so for sure it's not "dotted" line.

Also xx and yy variables should be predefined with "var" keyword, so they wont affect object variables.

Offline

Board footer

Powered by FluxBB