Killing Enemys
Posted: Thu Apr 17, 2014 2:40 pm
Hi! I want to kill an enemy with bullet but every time i shoot i get an error. Thats my code:
Error:
Code: Select all
function Enemy:update(dt)
local i, o, w, s
for i, o in ipairs(Enemy) do
for w, s in ipairs(bullets) do
if (s.x > w.x and s.x < w.x + w.width) and (s.y > w.y and s.y < w.y + w.height) then
table.remove(bullets, w)
table.remove(Enemy, i)
end
end
end
end