Code: Select all
function spawnZombie(x,y,speed,health,detection)
table.insert(enemies, {x = x, y = y, speed = speed, health = health, detection = detection, pic = love.graphics.newImage("pics/zombie.png")})
end
Code: Select all
for i,v in ipairs(enemies) do
love.graphics.draw(v.pic, v.x, v.y)
end
For some reason you can only attack the second zombie drawn. I think I know why though. I'm pretty sure it has to do with this little bit of code right here..
Code: Select all
if key == "j" and
side == right and
steve.x > v.x - steve.reach and
steve.x < v.x + steve.reach then
v.health = v.health - steve.damage
v.x = v.x - 30
v.y = v.y - 15
end
Any and all help is appreciated:)
P.S. use "a,d" to move, "w" to fly(temp), and "J" to attack