Page 1 of 1

Zombie Spawning problems

Posted: Mon Aug 18, 2014 6:32 pm
by Sinono3
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:

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
Please if you can transform the code, please :cry: (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

Re: Zombie Spawning problems

Posted: Mon Aug 18, 2014 6:44 pm
by MadByte
Hi & welcome on the forums!

First off, it would be great if you could remove your second thread. One should be enough :p
Then for your problem, I don't really get your question. What do you need to be done exactly?

Re: Zombie Spawning problems

Posted: Tue Aug 19, 2014 8:53 pm
by Sinono3
MadByte wrote:Hi & welcome on the forums!

First off, it would be great if you could remove your second thread. One should be enough :p
Then for your problem, I don't really get your question. What do you need to be done exactly?
Well, 2 things.
1st: I want to delete this thread for just keeping the other one, I dont know how so...
2nd: My question is: How do I do to make multiple zombies spawn?

Re: Zombie Spawning problems

Posted: Wed Aug 20, 2014 9:13 am
by MadByte
Here is a thread where I explain one way to do it:
Click me!