Something slightly playable:
Also, new code bit if you're really picky about what needs to be where, plus explaination. Code: Select all
def circler(x, y, mines, velocity, radius, offset):
m = mines
o = offset
v = velocity
r = radius
d = 360.0/m
m = 360.0/m
i = 0
while d <= (360.000+o):
if i == 0:
s = ['!12^', str(x), ',', str(y), '^^^,7,0,', str(v), ',', str(d+o), ',', str(r)]
s = "".join(s)
i = 1
d += d
else:
a = ['!12^', str(x), ',', str(y), '^^^,7,0,', str(v), ',', str(d+o), ',', str(r)]
a = "".join(a)
s += a
d += m
s = ''.join(s)
print(s)
Note that this was way painful to write on it's lonesome, explaining will be harder then balls. (which, on second thought, isn't very hard at all. -_- )
Code: Select all
def circler(x, y, mines, velocity, radius, offset):
This line is the magick maker. This defines what you're going to do, and tells you what parameters to put in. 'x, y' are the centre's coords, 'mines' is how many mines you want in the circle, 'velocity' is how fast the mines rotate, 'radius' is the circles radius, distance between any mine and what you put for 'x, y', to clarify it's importance. 'offset' can be 0 most of the time, but if you want the degree of the mines offset just a little, put how many degree's you want in for this.
Code: Select all
m = mines
o = offset
v = velocity
r = radius
d = 360.0/m
m = 360.0/m
i = 0
Turns long variables into short ones, and sets 'i' to equal one. 'i' is what tells Pthon to go to the initiating 'mine string', the foundation of the rest of the mines.
Take a look at the fifth and sixth lines.
-->>{{((These tell the degrees between each mine.
))}}<<-- the .0 in '360.0' tells Python to make it a float instead of an int, for much greater percision.
Tells python to continue making more mines while the circle is not complete. 'd' will equal '360+o' when all the mines are in place.
Code: Select all
s = ['!12^', str(x), ',', str(y), '^^^,7,0,', str(v), ',', str(d+o), ',', str(r)]
God, this will be hard to explain. This line gave me so much trauma.
Tells Python that 's' a large assortment of shit that will be combined into the code of one circle-pathed mine. Lemme break it down.
'!12^' is what the base of a mines code in N is, right? It won't make a mine without this bit.
'str(x), ',', str(y)' will take the integers or floats you should have put for x and y into the coords for the mines centre. the "','," puts a comma inbetween the two coordinates, makeing it one coord in 2d.
'^^^,7,0,' says that the mine will have circle pathing. The , at the end of the string helps us avoid needing another ',',, shortening the code slightly. Trivial, but meh.
'str(v)' is the speed of the mine's circling, 'str(d+o)' is where the mine should be, the degrees plus the offset, 'str(r)' is the radius.
's' is just an assortment of seperated strings right now, this turns it into one large string, the code for one mine.
Says that 'i' equals 1, shutting off this part of the script until 'i' equals 0 again, which doesn't happen in our script.
'd += d' says that 'd' know equals d*2, the next degree increment, making it so there aren't a ton of rotating mines all in one spot.
If our 'if i == 0:' statement isn't true, we go here.
Code: Select all
a = ['!12^', str(x), ',', str(y), '^^^,7,0,', str(v), ',', str(d), ',', str(r)]
What we had before, except instead having 's' equal all that shit, 'a' does now. 's' is our base, saying that 's' equals ruins everything we just did, and makes it so we can't have anything more.
Turns 'a' into a code for a single circling mine, and adds it on too our base, 's'. See how we'd be screwed over in the last line if we said 's = [...]' instead of 'a = [...]'?
We made two seperate variables equal the same thing in the beginning, 'm' and 'd'. If we kept going with 'd += d', we'd get something along the lines of 'd*2*2*2*2*2*2*2' after a while. Not good. 'm' never changes, except for the beginning, so we use it to add on to 'd', creating a new degree for the mine to start in.
Joins 's' into one überstring, what we put in Nreality to make the mines circle, and then prints it out for us to see.
Whew, that took about 30 minutes to explain. =\[/spoiler]