Leveling system

This commit is contained in:
Alexey 2025-06-25 16:51:23 +03:00
commit efe9f386bd
6 changed files with 83 additions and 26 deletions

View file

@ -2,35 +2,15 @@ require 'grid'
require 'point'
require 'line'
require 'mouse'
require 'makegrid'
function love.load()
love.graphics.setLineStyle( Config.lineStyle )
love.graphics.setLineWidth( Config.lineWidth )
GameGrid = Grid:new( Point:new( 5, 5 ) )
local line = Line:new(
GridPoint:new( 1, 1 ),
GridPoint:new( 3, 3 ),
Color.red
)
GameGrid:push( line )
local line1 = Line:new(
GridPoint:new( 1, 5 ),
GridPoint:new( 5, 2 ),
Color.green
)
GameGrid:push( line1 )
local line2 = Line:new(
GridPoint:new( 2, 5 ),
GridPoint:new( 5, 3 ),
Color.blue
)
GameGrid:push( line2 )
GameGrid = MakeGrid( require 'levels/test2' )
end
end
-- TODO: move input interactions into module
-- TODO: fix collision with other line's endpoint
function love.update( dt )
Mouse:update()
end
@ -45,6 +25,10 @@ function love.draw()
love.graphics.print( "drag", 64, 300 )
end
if Mouse.lastLine ~= nil then
love.graphics.print( tostring( Mouse.lastLine ), 128, 300 )
love.graphics.print( tostring( Mouse.lastLine ), 128, 300 )
end
if GameGrid:isCompleted() then
love.graphics.print( "Grid completed", 64, 320 )
end
end