Page 1 of 1

Please help with the zombie spawning ;-;

Posted: Mon Aug 18, 2014 6:19 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 (LOVE 0.9.1).
https://mega.co.nz/#!30oQ1R4I!mY3iQ_Hl7 ... S4CQyFDMQE

Re: Please help with the zombie spawning ;-;

Posted: Tue Aug 19, 2014 1:06 pm
by IceQB
Maybe you dont draw zombie? Code looks good.

Re: Please help with the zombie spawning ;-;

Posted: Tue Aug 19, 2014 2:20 pm
by Jeeper
Ps. I don't think having a youtube video in your signature is a good idea, rather make a link to it.

Re: Please help with the zombie spawning ;-;

Posted: Tue Aug 19, 2014 6:14 pm
by Jasoco
Jeeper wrote:Ps. I don't think having a youtube video in your signature is a good idea, rather make a link to it.
Yes, agreed. Please change it to a link. Forum signatures need to be simple and text only. Maybe occasionally a small image, but I'd prefer a simple text only signature. Most people only have text. I'm not sure images are even allowed/appreciated in sigs on this forum. They're too distracting.

Re: Please help with the zombie spawning ;-;

Posted: Tue Aug 19, 2014 8:44 pm
by Sinono3
Sorry for my ignorance. I tried to read the rules very fast. :nyu: