Level switching logic
This commit is contained in:
parent
efe9f386bd
commit
d4c4c7bfd0
3 changed files with 140 additions and 3 deletions
18
main.lua
18
main.lua
|
|
@ -2,17 +2,29 @@ require 'grid'
|
|||
require 'point'
|
||||
require 'line'
|
||||
require 'mouse'
|
||||
require 'makegrid'
|
||||
require 'levelhandler'
|
||||
Input = require 'input'
|
||||
|
||||
function love.load()
|
||||
love.graphics.setLineStyle( Config.lineStyle )
|
||||
love.graphics.setLineWidth( Config.lineWidth )
|
||||
|
||||
GameGrid = MakeGrid( require 'levels/test2' )
|
||||
GameGrid = LevelHandler:first()
|
||||
end
|
||||
|
||||
function love.update( dt )
|
||||
Mouse:update()
|
||||
Input:update()
|
||||
|
||||
if Input:actionReleased( 'exit' ) then
|
||||
love.event.quit()
|
||||
end
|
||||
|
||||
if Input:actionReleased( 'nextlevel' ) then
|
||||
if GameGrid:isCompleted() then
|
||||
GameGrid = LevelHandler:next()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function love.draw()
|
||||
|
|
@ -29,6 +41,6 @@ function love.draw()
|
|||
end
|
||||
|
||||
if GameGrid:isCompleted() then
|
||||
love.graphics.print( "Grid completed", 64, 320 )
|
||||
love.graphics.print( "Grid completed. Press space to proceed to next", 64, 320 )
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue