From 6a42aa46420073476944384c03219c9d89002d2a Mon Sep 17 00:00:00 2001 From: usysrc Date: Sun, 1 Dec 2024 18:49:43 +0100 Subject: [PATCH] feat: :sparkles: add divider module for visual separation in the game --- divider.lua | 10 ++++++++++ main.lua | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) create mode 100644 divider.lua diff --git a/divider.lua b/divider.lua new file mode 100644 index 0000000..93e555d --- /dev/null +++ b/divider.lua @@ -0,0 +1,10 @@ +local lg = love.graphics + +local divider = {} +local width = 16 +divider.draw = function() + lg.setColor(1,1,1) + lg.rectangle("fill", lg.getWidth()/2-width/2, 0, width, lg.getHeight()) +end + +return divider \ No newline at end of file diff --git a/main.lua b/main.lua index 8df9f38..1a846b8 100644 --- a/main.lua +++ b/main.lua @@ -3,9 +3,8 @@ -- local lick = require "lick" +local divider = require "divider" -lick.file = "main.lua" -- the file to watch for changes -lick.reset = true -- reload the whole game when a file is modified lick.debug = true -- show debug messages in the console -- A couple of shortcuts @@ -20,6 +19,7 @@ function love.update(dt) end function love.draw(dt) + lg.push() lg.setBlendMode("alpha") lg.translate(lg.getWidth() / 2, lg.getHeight() / 2) lg.rotate(1 * pi * cos(time / 10)) @@ -31,4 +31,6 @@ function love.draw(dt) 300 * sin(i / 4 * pi + time / 10), 200 * cos(i / 4 * pi + time / 5), 128) end + lg.pop() + divider.draw() end