I want to have some states in my game such as 'menu', 'options', 'help' etc. The idea is to load a splash screen initially and continue from there based on player input. I looked around the forum and decided on hump to achieve 'state' function in my game. But I don't think i'm doing it right love doesn't load the splash screen. Here' my code in my main.lua. Any help is appreciated. Thank you
menu = {}
function menu:init() --loading and drawing a splash screen
splash = love.graphics.newImage("splash.png")
end
function menu:draw()
love.graphics.draw(splash, game_width, game_height)
end
function love.load()
Gamestate.registerEvents()
Gamestate.switch(menu)
bg = {0,153,76}
love.graphics.setBackgroundColor(bg)
end
function love.load()
Gamestate.registerEvents()
Gamestate.switch(menu)
bg = {0,153,76}
love.graphics.setBackgroundColor(unpack(bg))
-- lua will see this as love.graphics.setBackgroundColor(0,153,76)
end
second, all positions in love2d start at the top-left. this means that your call to love.graphics.draw is drawing the top-left corner of the image at the bottom-right of the screen. try this: