Zombie Spawning problems
Posted: Mon Aug 18, 2014 6:32 pm
I'm making a zombie game, but... I had to many problems with the AI Spawning. I already searched on all the forums (I think).
And nothing worked, I giving my code of the zombie AI:
Please if you can transform the code, please (I'm a newbie to code)
Sorry, I tried to attach my love file but it dont works, so I will give you a link.
https://mega.co.nz/#!30oQ1R4I!mY3iQ_Hl7 ... S4CQyFDMQE
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.
https://mega.co.nz/#!30oQ1R4I!mY3iQ_Hl7 ... S4CQyFDMQE