A weird error I cant fix
Posted: Sat Jun 08, 2013 9:54 pm
Heres my code:
require "player"
require "zombie"
require "inventory"
require "items"
menuTexture = love.graphics.newImage("menuBackground.png")
rt = love.graphics.newImage("spawn.png")
gs = "menu"
buttonImage = love.graphics.newImage("buttonTexture.png")
registerItems()
function switchRoom(texture)
rt = texture
end
function love.update()
if gs == "menu" then
if (love.mouse.getX() > 270 and love.mouse.getX() < 500) and (love.mouse.getY() > 300 and love.mouse.getY() < 391) then
if love.mouse.isDown("l") == true then
gs = "chooseGame"
end
end
end
end
function renderGame()
love.graphics.draw(rt)
updateZombies()
updatePlayer()
updateInventory()
end
function love.draw()
if gs == "playing" then
renderGame()
else
if gs == "menu" then
love.graphics.draw(menuTexture)
love.graphics.draw(buttonImage, 250, 300)
love.graphics.setColor(0,0,0)
love.graphics.print("Play", 300, 310, 0, 5)
love.graphics.setColor(255,255,255)
end
if gs == "chooseGame" then
love.draw(buttonImage, 250, 300)
end
end
end
Heres my error:
Error: main.lua:77: stack overflow
stack traceback:
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
...
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
[string "boot.lua"]:410: in function <[string "boot.lua"]73>
[C]: in function 'xpcall'
I would like to say I dont know whats causing the error AND there is no line 77, help?
require "player"
require "zombie"
require "inventory"
require "items"
menuTexture = love.graphics.newImage("menuBackground.png")
rt = love.graphics.newImage("spawn.png")
gs = "menu"
buttonImage = love.graphics.newImage("buttonTexture.png")
registerItems()
function switchRoom(texture)
rt = texture
end
function love.update()
if gs == "menu" then
if (love.mouse.getX() > 270 and love.mouse.getX() < 500) and (love.mouse.getY() > 300 and love.mouse.getY() < 391) then
if love.mouse.isDown("l") == true then
gs = "chooseGame"
end
end
end
end
function renderGame()
love.graphics.draw(rt)
updateZombies()
updatePlayer()
updateInventory()
end
function love.draw()
if gs == "playing" then
renderGame()
else
if gs == "menu" then
love.graphics.draw(menuTexture)
love.graphics.draw(buttonImage, 250, 300)
love.graphics.setColor(0,0,0)
love.graphics.print("Play", 300, 310, 0, 5)
love.graphics.setColor(255,255,255)
end
if gs == "chooseGame" then
love.draw(buttonImage, 250, 300)
end
end
end
Heres my error:
Error: main.lua:77: stack overflow
stack traceback:
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
...
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
main.lua:77: in function 'draw'
[string "boot.lua"]:410: in function <[string "boot.lua"]73>
[C]: in function 'xpcall'
I would like to say I dont know whats causing the error AND there is no line 77, help?