Code: Select all
for i = 1, #location do -- location checks if the tile in the time map is where a coin should be placed (works perfectly)
local inst = location[i]
coin[i] = {
x = inst.x + 8,
y = inst.y + 8,
w = 8,
h = 8,
index = i, -- This value holds the index of each specific coin
isCoin = true
}
world:add(coin[i], coin[i].x - coin[i].w * 0.5, coin[i].y - coin[i].h, coin[i].w, coin[i].h)
end
Code: Select all
if other.other.isCoin then -- uses bump.lua, other is cols[i]
--remove coin from coin table
table.remove(coin, other.other.index) -- works but not well
--remove coin from world
world:remove(other.other) -- I assume works perfectly fine since it should remove the coin from the physics world
end