explosion= {}
explosion[1] = love.graphics.newImage("images/boom1.png") --images are in their proper directories.
explosion[2] = love.graphics.newImage("images/boom2.png")
explosion[3] = love.graphics.newImage("images/boom3.png")
explosion[4] = love.graphics.newImage("images/boom4.png")
animtimer = 0
eximg = explosion[1] --I've tried removing this
anum = 1 --dictates which image is used
function explode(dt) --This is just supposed to make the explosion images cycle through
animtimer = animtimer+dt
eximg = eximg[anum] --I've tried moving this and removing it entirely. It just says that it's incorrect parameter type in the draw function.
if animtimer > 0.1 then --Just temp numbers and whatnot.
anum = anum+1
animtimer = 0
end
if anum > 4 then
anum = 1
end
end
function love.update(dt)
explode(dt)
end
function love.draw()
love.graphics.draw(eximg[anum],20,20) --It errors here saying that eximg is nil
end
Everything else in my "game" Is working just fine, but for some reason it's refusing to let me animate saying that a variable that clearly exists(I think...) is nil.
I'm sure it's just a stupid error but I can't seem to find it.
I've left it pretty heavily commented for this to make sure people can read my entry-level code.