ID:273939
 
Ok I've been trying to do this for hours. Can you show me some code which makes an object move in an outward spiral pattern?

Here's what I have an it's a total failure:
obj/proc/Spiral() spawn if(src)
var/N=0
var/NN=2
while(src)
N+=0.5
new/turf/GroundDirt(loc)
if(N==round(N,NN))
step(src,turn(dir,45))
N=0
NN++
else step(src,dir)
sleep(1)


Thanks.
mob/spiral
New()
..()
Spiral()
proc/Spiral()
var/I = 200
var/S = 1
var/turf/T = loc
while(I>0)
step(src,dir)
if(get_dist(T,src)>=S)
dir=turn(dir,45)
S++
I--
sleep(1)


It spirals, but due to the tile based movement and the lack of a way to specify only using cardinal directions in distance, it's fairly ugly.