• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GML any idea how can i make a dynamic circle [SOFT] diagram ? [SOLVED]

K

Kasra

Guest
any idea how can i make a circle diagram like image below ?
circle_diagram.png
this kind of diagram help me draw more simple and efficient GUI for android. tnx
i have some codes about drawing some line with same distance to center like fractal, but i think there is better way
 
K

Kasra

Guest
i write a code like below in my circle_diagram object:
Code:
//**START OF THE CREATE EVENT**//
//****ATTRIBUTES*****//
radious       = 128;
split_number  = 48; // 75% IS FULLED
split_module  = 64;
diagram_colour= c_red;
diagram_width = 5;
diagram_alpha = 1;
base_degree   = 90;
//****ATTRIBUTES*****//
//*******************//
//*****CONSTANTS*****//
p             = 3.1415;
perimeter     = 2*p*radious;
split_lenght  = perimeter / split_module;
split_degree  = 360       / split_module;
//*****CONSTANTS*****//
//***END OF THE CREATE EVENT***//
//*****************************//
//***SATRT OF THE DRAW EVENT***//
//THIS VAR WILL RESET AS THE EVENT END'S
var doff = base_degree;

for(var i = 0; i < split_number; i++)
{
    var lx_1, ly_1, lx_2, ly_2;
    // line_x&y_coordinates
    lx_1 = dcos(doff)*radious + x;
    ly_1 =-dsin(doff)*radious + y;
    doff+= split_degree;
    // update x_2 & y_2
    lx_2 = dcos(doff)*radious + x;
    ly_2 =-dsin(doff)*radious + y;
    draw_set_alpha(diagram_alpha);
    draw_line_width_colour(lx_1, ly_1, lx_2, ly_2, diagram_width, diagram_colour, diagram_colour);
    draw_set_alpha(diagram_alpha);
}
//***END OF THE DRAW EVENT ****//
this works, but it is so basic and edges are not soft, on android devices it look very bad, so how can i found a better way for this ?
(i need this diagram for show my ammo, [exactly like ldoe game])
 
K

Kasra

Guest
In a word, basically like this.
yep that algorithm in the link worked like a charm !, it will looks soft only if i remove draw_line_width and replace drawing line code [in width 1] like image below, tnx
upload_2019-3-26_11-20-5.png
 
T

Taddio

Guest
yep that algorithm in the link worked like a charm !, it will looks soft only if i remove draw_line_width and replace drawing line code [in width 1] like image below, tnx
View attachment 23915
Yeah, Dave stuff is really solid, you should bookmark that and check it out from the home page up if you're not familiar with it!
 
Top