bone = {}
btwo = {}
yoffset = 32
function _init()
bone.x = 8
bone.y = 40
btwo.x = 104
btwo.y = 88
end
function _update()
cls()
if(btnp(0)) then
movex(-8)
end
if(btnp(1)) then
movex(8)
end
if(btnp(2)) then
movey(-8)
end
if(btnp(3)) then
movey(8)
end
end
function _draw()
rectfill(0,0,127,127,7)
map(0,0,0,yoffset,16,16)
spr(1, bone.x, bone.y)
spr(2, btwo.x, btwo.y)
end
function ispath(x, y)
tile = mget(x, y)
if(fget(tile, 2)) return true
end
function movex(direction)
x1 = bone.x + direction
x2 = btwo.x - direction
playsnd = false
if ispath((x1/8), ((bone.y-yoffset)/8)) then
bone.x += direction
playsnd = true
end
if ispath((x2/8), ((btwo.y-yoffset)/8)) then
btwo.x += -direction
playsnd = true
end
if (playsnd) sfx(00)
end
function movey(direction)
y1 = bone.y + direction
y2 = btwo.y - direction
playsnd = false
if ispath((bone.x/8), ((y1-yoffset)/8)) then
bone.y += direction
playsnd = true
end
if ispath((btwo.x/8), ((y2-yoffset)/8)) then
btwo.y += -direction
playsnd = true
end
if (playsnd) sfx(00)
end