Hump gamestate callback not working?
Posted: Mon Dec 17, 2018 5:21 am
I'm having an issue with the Hump gamestate library. Everything works upon startup, but if I return to the menu from my first level, the menu:mousereleased callback doesn't work, even though menu:enter, menu:update and menu:draw do.
Here's the code:
Any help would be great
Here's the code:
Code: Select all
menu = {}
function menu:enter()
menuimage = love.graphics.newImage("assets/images/menuimage.png")
cam:lookAt(menuimage:getWidth()/2, menuimage:getHeight()/2)
end
function menu:update(dt)
end
function menu:draw()
cam:attach()
love.graphics.draw(menuimage, 0, 0)
cam:detach()
end
function menu:mousereleased(x, y, key)
x = mouse.worldx
y = mouse.worldy
if x >= 25 and x <= 175 and y >= 285 and y <= 355 and key == 1 then
gamestate.switch(levelone)
end
end