Code: Select all
function tile:spawn(x, y, coli, img, width, height)
table.insert(tilem, {x = x--[[int]], y = y--[[int]], coli = coli--[[bool]], img = img--[[string]], width = width--[[int]], height = height--[[int]]})
end
Code: Select all
function tilep:coli()
for i,v in ipairs(tilep) do
if v.coli == true then
if char.x >= v.x - 14 and char.x <= v.x + v.width - 14 and char.y >= v.y - 21 and char.y <= v.y + v.height - 21 then
char.y = v.y - 21
end
if char.x >= v.x and char.x <= v.x + v.width and char.y >= v.y - 21 and char.y <= v.y + v.height - 21 then
char.y = v.y - 21
end
if char.x >= v.x - 14 and char.x <= v.x + v.width - 14 and char.y <= v.y + 21 and char.y >= v.y - v.height + 21 then
char.x = v.x - 14
end
if char.x >= v.x - 14 and char.x <= v.x + v.width - 14 and char.y <= v.y and char.y >= v.y - v.height then
char.x = v.x - 14
end
end
end
end
end