maketangible('grass') if global.once("build grass") then for y=0,4 do for x=0,y%2==1 and 3 or 4 do tangible.build{class="grass",x=y%2==1 and 2*x+1 or 2*x+1,y=2*y+1,z=0,plane="main",graphic="grass"} end end end if global.once("walkable") then global.walkable={} end if global.once("walkable main") then global.walkable["main"]={} end function walkable(pl,x,y) if not global.walkable then return false end if not global.walkable[pl] then return false end if not global.walkable[pl][y] then return false end return global.walkable[pl][y][x] or false end function setwalkable(pl,x,y,val) if not global.walkable[pl][y] then global.walkable[pl][y]={} end global.walkable[pl][y][x]=val end if global.once("walkablexy") then for y=0,4 do for x=0,4 do setwalkable("main",x,y,true) end end end function player.move(actor,place,dx,dy) local _,pl,x,y,_,_=tangible.animstate(actor) print("Checking walkable "..pl.." "..x.." "..y.." is "..(walkable(pl,x+dx,y+dy) and "true" or "false")) if not walkable(pl,x+dx,y+dy) then print("Not walkable") else tangible.animate(place, {action="walk", dx=dx,dy=dy}) local lis=tangible.near(actor,1,false,true) if #lis==0 then print("The area is empty") else for _,t in pairs(lis) do print("There is a "..tangible.getclass(t).." here") end end end _,pl,x,y,_,_=tangible.animstate(actor) print("Your location is "..x.." "..y) end