C
C#2y ago
MaGiiKx

✅ Concentric Circles

Hi, If you look at the image, you can that each time a circle is being draw, it is shifted to the right a bit. I don't want it to do that. I want it to draw the circles like a dartboard basically. below is the code for my circle case block. please can you help me figure it out? https://hastebin.com/medoqapadu.csharp
Hastebin: Send and Save Text or Code Snippets for Free | Toptal®
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
8 Replies
Anchy
Anchy2y ago
my guess is you need to move your circle based on the radius change when you draw a new circle it looks like it isnt being shifted at all, in fact it's drawing from top left to bottom right for all circles
Anchy
Anchy2y ago
Anchy
Anchy2y ago
as you can see here they all share the same point, so for each circle after the first you need to shift the circle by x radius im not sure what the code for your Fill and Draw look like but I am assuming it's drawing like a rect not a expanding from the centre you'll have to offset it in your Fill and Draw functions
MaGiiKx
MaGiiKxOP2y ago
so should i just move this
// Increment the x coordinate by the diameter of the circle
x += radius * 2;

// If the x coordinate has reached 100, reset it to 0 and increment the y coordinate
if (x == 100)
{
x = 0;
y += radius * 2;
}
// Increment the x coordinate by the diameter of the circle
x += radius * 2;

// If the x coordinate has reached 100, reset it to 0 and increment the y coordinate
if (x == 100)
{
x = 0;
y += radius * 2;
}
into the for loop if statement?
Anchy
Anchy2y ago
you just need to shift by the radius, not the diameter if you shift by the diameter you will achieve the same pattern but backwards also I just realized you are adding, you want to subtract from x & y since you are drawing from top left to bottom right x -= radius; y -= radius; then if I am correct your circles center point should be at 200,200
MaGiiKx
MaGiiKxOP2y ago
MaGiiKx
MaGiiKxOP2y ago
at least its changed direction lmfaoo
// Increment the x coordinate by the diameter of the circle
x -= radius;

// If the x coordinate has reached 100, reset it to 0 and increment the y coordinate
if (x == 100)
{
x -= radius;
y -= radius ;
}
// Increment the x coordinate by the diameter of the circle
x -= radius;

// If the x coordinate has reached 100, reset it to 0 and increment the y coordinate
if (x == 100)
{
x -= radius;
y -= radius ;
}
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server