gamestate = "title"
function love.update(dt)
mainmenu = love.graphics.newImage("back.jpg")
playbackground = love.graphics.newImage("playbackground.png")
music = love.audio.newSource( 'background.mp3', 'stream' )
music:setLooping( true ) --so it doesnt stop
music:play()
if gamestate == "title" then
if love.keyboard.isDown("return", "enter") then
gamestate = "play"
end
else
-- do your game logic here
end
end
end
function love.draw()
love.graphics.draw(mainmenu)
if gamestate == "title" then
love.graphics.print( "Press Enter To Play")
else
-- draw your game here
end
end
end
First, please check out the wiki if you haven't yet, since it will tell you, if you look up all those love._.new_ functions, that you should not use them in love.update, since it will run every frame.
Use love.load to load assets only once at the beginning of the game;
and also use the local keyword to not pollute the global namespace with variables.
Me and my stuff True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.