Hump gamestate callback not working?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
Meh
Prole
Posts: 2
Joined: Tue Oct 31, 2017 7:00 am

Hump gamestate callback not working?

Post by Meh »

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:

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
Any help would be great :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Semrush [Bot] and 12 guests