Code: Select all
Gamestate = require "hump.gamestate"
local menu = {}
local game = {}
local intro = {}
function menu:init()
bgImg = love.graphics.newImage('assets/gfx/mmbg.png')
menuOp = love.graphics.newImage('assets/gfx/options_menu.png')
end
function menu:enter()
menu:update()
end
function menu:update()
end
function menu:draw()
love.graphics.draw(bgImg, 0, 0)
love.graphics.draw(menuOp, 256, 240)
if continuePressed == true then
love.graphics.print('continuePressed', 10, 10)
elseif optionsPressed == true then
love.graphics.print('optionsPressed', 10, 10)
end
end
function menu:mousepressed(x, y, button)
if button == 'l' then
if x > 256 and x < 384 and y > 240 and y < 288 then
return Gamestate.switch(intro)
elseif x > 256 and x < 384 and y > 298 and y < 346 then
continuePressed = true
elseif x > 256 and x < 384 and y > 356 and y < 404 then
optionsPressed = true
end
end
intro:update()
end
function menu:mousereleased(x, y, button)
if button == 'l' then
continuePressed = false
optionsPressed = false
end
end
function intro:init()
introImg = love.graphics.newImage('assets/gfx/newGameScreen.png')
backButton = love.graphics.newImage('assets/gfx/backButton.png')
end
function intro:enter()
intro:update()
end
function intro:update()
end
--This function will of course be replaced when the actual intro sequence is coded
function intro:draw()
love.graphics.draw(introImg, 0, 0)
love.graphics.draw(backButton, 256, 240)
end
--This function will similarly be deleted
function intro:mousepressed(x, y, button)
if button == '1' then
return Gamestate.switch(menu)
end
end
function game:update(dt)
--
end
function love.load()
Gamestate.registerEvents()
Gamestate.switch(menu)
end
LÖVE,
CaptainSwordsman