Let's say you want to make some circles on a tilemap. Specifically, circles shaped like these.
I've successfully got squares and triangles going, using for loops that count though -ycount,ycount and -xcount,xcount, so if ycount is 4 and xcount is 2 you'd get a shape going -4,-2, -4,-1, -4, 0, -4, 1, -4, 2, and so on. And I've figured out some of the rules for these circles: if you start your radius as 3 and a variable - let's call it radcount - at 2, your radius goes up by 2 (to keep the number odd), your radcount goes up by 1, radius - radcount = your y and x counts (so a radius of 7 would give you a ycount 6, so you'd draw -6, -5, etc down to 0, then back up the positive side).
Code: Select all
3 / radcount 2
ycount = 1
xcount = 1
5 / radcount 3
ycount = 2
xcount = (2) 2, 1
7 / radcount 4
ycount = 3
xcount = (3) 3, 2, 1
9 / radcount 5
ycount = 4
xcount = (4) 4, 4, 3, 2
11 / radcount 6
ycount = 5
xcount = (5) 5, 5, 4, 3, 2
13 / radcount 7
ycount = 6
xcount = (6) 6, 6, 5, 5, 4, 2
15 / radcount 8
ycount = 7
xcount = (7) 7, 6, 6, 5, 4, 3, 1
I can't figure out the rule for the length of each row (xcount), nor how to write this loop. Googling tells me that this is probably relevant to my interests but I can't figure out how to apply that, either.
Any help is appreciated.