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?
A weird error I cant fix
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Re: A weird error I cant fix
Could you maybe upload a .love version of your entire source? I don't think this is enough to find the error.
(If it helps, this looks like a very clear sign of infinite recursion, so I'm pretty sure that the problem is that your love.draw function is calling itself somewhere in it, but since I don't have the definitions of the other functions, I cannot see where)
(If it helps, this looks like a very clear sign of infinite recursion, so I'm pretty sure that the problem is that your love.draw function is calling itself somewhere in it, but since I don't have the definitions of the other functions, I cannot see where)
Re: A weird error I cant fix
In your love.draw you call: This should be
Code: Select all
love.draw(buttonImage, 250, 300)
Code: Select all
love.graphics.draw(buttonImage, 250, 300)
-
- Prole
- Posts: 16
- Joined: Mon May 20, 2013 7:39 pm
Re: A weird error I cant fix
THANK YOU!!!!
Re: A weird error I cant fix
Can't believe I missed that
- Jasoco
- Inner party member
- Posts: 3726
- Joined: Mon Jun 22, 2009 9:35 am
- Location: Pennsylvania, USA
- Contact:
Re: A weird error I cant fix
Please use the Code tags when posting code or errors. It makes it easier to read and saves a lot of scrolling time.
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 3 guests