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

GameMaker Drawing Circle with Varying Alpha

T

Taylor Romey

Guest
I want to draw a circle that has a set alpha in the middle, and a different alpha near the edge. (Essentially a circle with faded edges)

I know "draw_circle_color" draws a circle with a different color in the middle than the edge, but doesn't deal with alpha. I have searched the help file for a function that does this and can't seem to find one.

I have tried using a for loop to draw individual circles of varying size and alpha to imitate the effect I'm looking for however it seems grossly inefficient. Considering that I'd like to have many of these circles drawn.

Code:
var i, n;
n = 100;
for(i=n;i>0;i--)
{
draw_set_alpha(1-(i/n));
draw_circle_color(x,y,(sprite_width/2)+(i*2),make_color_hsv(40,255*(1-(i/n)), 255),make_color_hsv(40,255*(1-(i/n)), 255),false);
}
Does GMS2 have a function that can draw a circle like this?
 
You can use blend modes to achieve this. Like drawing a colored circle black to white (or white to black, I forget), and using the additive or subtractive blend mode (again, I forget). But yeah it's possible!
 
Top