function zombieType:create(v)
local instance = {}
setmetatable(instance, {__index = self})
instance:reset(v)
return instance
end
function zombieType:reset(v)
v = v or {}
self.x = v.x or 300
self.y = v.y or 500
self.speed = v.speed or 100
self.color = v.color or { 255, 255, 255 }
self.health = v.health or 10
self.pic = v.img or zombImg
self.reach = v.reach or 55
self.damage = v.damage or 2
end
function zombieType:update(dt)
end
function zombieType:draw()
love.graphics.draw(zomb, math.random(350), math.random(400), 0, 4, 4)
end
I've also tried using math.random to pick a place for them to spawn, pick a place for them to move to, and to dictate the amount of damage they deal, but that just gave me a bunch of syntax errors.
Without your whole code we can't help you much, but offhand I will point out that you are drawing your zombie at a random location: since you choose the position again for each frame, it may just be that you can't see your zombie because they move to a new location every single frame.
tentus wrote:Without your whole code we can't help you much, but offhand I will point out that you are drawing your zombie at a random location: since you choose the position again for each frame, it may just be that you can't see your zombie because they move to a new location every single frame.