Code: Select all
for i = #coins, 1, -1 do
local coin = coins[i]
if coin:enter("ball") then
-- Coin has been collected
coin:destroy()
table.remove(coins, i)
score = score + 1
end
end
Code: Select all
for i = #coins, 1, -1 do
local coin = coins[i]
if coin:enter("ball") then
-- Coin has been collected
coin:destroy()
table.remove(coins, i)
score = score + 1
end
end