I just got the bullets working correctly. But I am unsure how to make them hurt the zombie. I know usually how to do collision. But I am going to need the x values from two different tables to do so. How would I do that? Obviously I just wanna say something like
Code: Select all
if the bullets x position > the zombies x position and
the bullets x position < the zombies x position + 48 and
the bullet y postition > the zombies y position and
the bullets y position < the zombies y position + 48 then
table.remove(bullet, i)
zombies health = zombies health - steve.damage(steve is the player)
Also I noticed while testing my game, that the zombies tend to overlap alot. And I want to stop that from happening. But I can't just say...
Code: Select all
for i,v in ipairs(zombie) do
if v.x > v.x then
v.x = v.x
end
end
Thanks In advanced:)