Bingdom
Googledom
So basically i'm trying to form my own improved draw_circle called draw_circle_ext, which allows the user to determine the amount of sides the circle has. The problem i'm having is that when i want to draw the circle, i'm having issues centering it. I've managed to work out how to center the left/right but i'm having issues working out how to center the up/down.
Here is what i've done
Here is what i've done
Code:
///draw_circle_ext(x,y,radius,sides);
var xx = argument0 - (argument2/argument3)/2; //Fine
var yy = argument1 + (argument2/argument3)/2; //Can't figure out
var rad = argument2;
var sides = argument3;
var dir = 0; //Right
var xxx = xx,yyy = yy;
repeat(sides) {
xxx += lengthdir_x(rad/sides,dir);
yyy += lengthdir_y(rad/sides,dir);
draw_line(xx,yy,xxx,yyy);
xx = xxx;
yy = yyy;
dir += 360/sides;
}