#1✎ 570random_godIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!HobbiesHey, how can I make a circle using a for loop? That seems the best way I can get a completely filled circle, but I can't quite get the shape. Here is my code:
DEF GCIRCFL CENTX,CENTY,RADI
FOR X=CENTX-RADI TO CENTX+RADI
FOR Y=CENTY-RADI TO CENTY+RADI
GLINE CENTX,CENTY,X,Y
NEXT
NEXT
END
GCIRCFL 200,120,20'I want this to make a circle
I know this makes a box, and how that works, but no matter how I change it I can't make it a circle. Can anyone help?
Posted
#2✎ 166512Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourselfhttps://smilebasicsource.com/page?pid=1303
Posted
Edited
by 12Me21
#3✎ 252ProKukuAvatar TabooI didn't change my avatar for 180 daysWebsiteFinal(?) Contest Runner UpI placed 2nd in the (possibly) final SmileBASIC Source Contest! October 2018Programming ContestCthulhuJoin the cultEaster Eggshttps://smilebasicsource.com/page?pid=1051 I used Simeon’s code and it works fine.
Posted
#4✎ 166512Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express Yourself
It doesn't work when the circle is completely in an offscreen part of the GRP.
Posted
#5✎ 570random_godIntermediate ProgrammerI can make programs, but I still have trouble here and there. Programming StrengthZelda Is Awesome!I love The Legend Of Zelda!Express YourselfVideo GamesI like to play video games!Hobbies
#6✎ 453kenchicFirst YearMy account is over 1 year oldWebsiteBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strengthosu! Is Awesome!I love osu!Express Yourself
https://smilebasicsource.com/page?pid=1303
But what if 2 circles overlap?
it uses a special color for the bounding circle which isn't used anywhere else (int form: 8)
then it fills that circle with the fill color using GPAINT, specifying the special color as the boundary color so it will completely ignore other colors until it hits the bounding circle
then it redraws the bounding circle with the actual (usually fill) color so there isn't any special color (8) left to mess with future filled circle drawing
Posted
Edited
by kenchic
#7✎ 166512Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfYeah. And color 8 is RGB(0,0,0,8)
All colors that are transparent (RGB(0,anything,anything,anything)) look identical, so there's no reason that anyone would use 8 rather than 0. It's safe to assume that these colors won't be used for anything else.
Posted
Edited
by 12Me21
#8✎ 98seggiepantsIf you aren't looking for real time speed or perfect accuracy, I would approximate it with triangles layed out pie chart style (triangle fan). You could even change the triangle count based on radius, although less than 3 or more than 360 is probably silly.
This way you don't have to worry about flood fill running into the stop color prematurely or if it goes offscreen. (I assume the flood fill would be faster just due to less function calls)
You could also try just putting in a Sprite of a filled circle and shrinking/ growing it as needed.
Posted
#9✎ 166512Me21Head AdminThird YearMy account is over 3 years oldWebsiteSyntax HighlighterReceived for creating the code syntax highlighter on SBSNight PersonI like the quiet night and sleep late.Express YourselfWhat you could do is draw the filled circle using GCIRCLE/GPAINT on an unused empty graphics page, then GCOPY it to the main page, if you NEED to use weird transparent pixels for some reason.
Posted
#10✎ 453kenchicFirst YearMy account is over 1 year oldWebsiteBeginner ProgrammerI'm just starting out! I'm still trying to grasp the basics.Programming Strengthosu! Is Awesome!I love osu!Express Yourself
...GCOPY it to the main page, if you NEED to use weird transparent pixels for some reason.
at that point you'd probably just want to use a scaled circle sprite
Posted