I want the entities to basically take damage from the bullets fired at them by the player but...
(This is in my Entities.lua under each of the enemies' update/AI sections)
Code: Select all
brgx = self.x
brgy = self.y
for i, v in ipairs(bullet) do
bvx = v.x
bvy = v.y
end
if brgx == bvx and brgy == bvy and self.hitready == true then
self.health = self.health - player.damage
end
if self.health >= 0 then
for i, v in ipairs(bullet) do
table.remove(enemies, i)
end
end
Everything else in the game works fine such as player collision with entity and so on.
Thanks for your help in advance