And nothing worked, I giving my code of the zombie AI:
Code: Select all
require("player")
zombie = {}
function zombie.load()
zombie.img = love.graphics.newImage("images/zombie.png")
zombie.x = 400
zombie.y = 300
zombie.speed = 1
end
function zombie.update()
zombie.angle = math.atan2(player.x - zombie.x, zombie.y - player.y)
if player.x < zombie.x then
zombie.x = zombie.x - zombie.speed
end
if player.x > zombie.x then
zombie.x = zombie.x + zombie.speed
end
if player.y < zombie.y then
zombie.y = zombie.y - zombie.speed
end
if player.x > zombie.x then
zombie.y = zombie.y + zombie.speed
end
end
Sorry, I tried to attach my .love file but it dont works, so I will give you a link (LOVE 0.9.1).
https://mega.co.nz/#!30oQ1R4I!mY3iQ_Hl7 ... S4CQyFDMQE