Please help with the zombie spawning ;-;

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Sinono3
Prole
Posts: 7
Joined: Mon Aug 18, 2014 5:52 pm

Please help with the zombie spawning ;-;

Post 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
Last edited by Sinono3 on Tue Aug 19, 2014 8:50 pm, edited 1 time in total.
User avatar
IceQB
Citizen
Posts: 67
Joined: Sat Nov 03, 2012 1:11 pm

Re: Please help with the zombie spawning ;-;

Post by IceQB »

Maybe you dont draw zombie? Code looks good.
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Please help with the zombie spawning ;-;

Post by Jeeper »

Ps. I don't think having a youtube video in your signature is a good idea, rather make a link to it.
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Please help with the zombie spawning ;-;

Post 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.
User avatar
Sinono3
Prole
Posts: 7
Joined: Mon Aug 18, 2014 5:52 pm

Re: Please help with the zombie spawning ;-;

Post by Sinono3 »

Sorry for my ignorance. I tried to read the rules very fast. :nyu:
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Semrush [Bot] and 4 guests