Drawing_circles script (filled or not filled)
Posted: Thu Feb 19, 2015 2:30 am
Here's how you can draw circles using a script I made.
Copy and paste this to the global code area in game-editor.
to draw a non-filled Circle, use this:
draw_circle(x, y, r, g, b, tra, radius, smoothing);
the smoothing value makes it slightly larger.
to make a filled circle, use this:
draw_circle_filled(x, y, r, g, b, tra, radius, smoothing);
likewise the smoothing value makes it smoother.
Screenshots:
seen above.
- Code: Select all
#define pi 3.14159265359
void draw_circle_filled(int X, int Y, int R, int G, int B, double A, double rad, int smooth)
{
double i;
moveto(X, Y);
setpen(R, G, B, A, 3+smooth);
for(i=0;i<pi*2;i+=pi/rad/(pi/3))
{
moveto(X, Y);
lineto(X+cos(i)*rad, Y+sin(i)*rad);
}
}
void draw_circle(int X, int Y, int R, int G, int B, double A, double rad, int smooth)
{
double i;
moveto(X, Y);
setpen(R, G, B, A, 1+smooth);
for(i=0;i<pi*2;i+=pi/rad/(pi))
{
putpixel(X+cos(i)*rad, Y+sin(i)*rad);
}
}
Copy and paste this to the global code area in game-editor.
to draw a non-filled Circle, use this:
draw_circle(x, y, r, g, b, tra, radius, smoothing);
the smoothing value makes it slightly larger.
to make a filled circle, use this:
draw_circle_filled(x, y, r, g, b, tra, radius, smoothing);
likewise the smoothing value makes it smoother.
Screenshots:
seen above.