mob
AI
icon='AI.dmi'
density=1
dir=EAST
New()
var/ddir=rand(1,2)
if(ddir==1) src.dir=EAST
if(ddir==2) src.dir=WEST
var/loop=2;while(loop)
//var/obj/O
var/turf/nx = locate(src.x+1,src.y,src.z)
if(src.dir==EAST) nx = locate(src.x+1,src.y,src.z)
if(src.dir==WEST) nx = locate(src.x-1,src.y,src.z)
//if(locate(/obj/Brick) in nx||locate(/obj/grass) in nx)
//if(locate(density) in nx&&O.density==1)
//if(locate(dense) in nx.loc)
if(nx.density==1)
if(src.dir==EAST) src.dir=WEST
else if(src.dir==WEST) src.dir=EAST
else
var/turf/NXT = locate(nx.x+1,src.y-1,src.z)
if(src.dir==EAST) NXT = locate(src.x+1,src.y-1,src.z)
if(src.dir==WEST) NXT = locate(src.x-1,src.y-1,src.z)
if(NXT.density==0)
src.Move(nx,src.dir)
sleep(3)
Problem description:
the part that says 'nx density' is not working. I keep on trying to change it to check for density there but it will not co-operate.... Can someone tell me how to fix this? PS: this is a side scroller thing
nx is null, so you can't locate(nx.x+1, ...), because there is no nx.x.