From 9c162282a71511abf631a8ded0b8de9f49d253dd Mon Sep 17 00:00:00 2001 From: Ivan Kuzmenko <6745157+rndtrash@users.noreply.github.com> Date: Fri, 12 Sep 2025 03:57:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=91=D0=B0=D0=B7=D0=BE=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20=D1=8E=D0=BD=D0=B8=D1=82=D0=B0?= =?UTF-8?q?,=20=D0=BF=D1=80=D0=BE=D1=81=D1=82=D0=B5=D0=B9=D1=88=D0=B8?= =?UTF-8?q?=D0=B9=20=D1=8E=D0=BD=D0=B8=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- game/main.lua | 12 +++++++++-- game/res/unit.png | Bin 0 -> 217 bytes game/unit.lua | 50 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 game/res/unit.png create mode 100644 game/unit.lua diff --git a/game/main.lua b/game/main.lua index 1e38d95..f4f764d 100644 --- a/game/main.lua +++ b/game/main.lua @@ -14,6 +14,8 @@ local mapX = 0 local mapY = 0 local mapSpeed = 32 +local someUnit + local function drawText(str, x, y) local font = love.graphics.getFont() love.graphics.print(str, x - font:getWidth(str) / 2, y - font:getHeight() / 2) @@ -48,6 +50,8 @@ function love.load() ) tilemap:random(10, 10) + require "unit" + someUnit = SomeUnit:new(tilemap, 30, 30) end -- 0: nothing @@ -117,13 +121,17 @@ function love.draw() -- tilemap.offsetX = 50 + math.floor(math.cos(time) * 25) -- tilemap.offsetY = 50 + math.floor(math.sin(time) * 25) tilemap:update() - local tilemapPosX = tilemap.offsetX - local tilemapPosY = tilemap.offsetY + -- local tilemapPosX = tilemap.offsetX + -- local tilemapPosY = tilemap.offsetY + local tilemapPosX = 10 + local tilemapPosY = 10 tilemap:draw(tilemapPosX, tilemapPosY) love.graphics.setColor(255, 0, 0) love.graphics.rectangle("line", tilemapPosX - 1, tilemapPosY - 1, 16 * 5 + 1, 16 * 5 + 1) love.graphics.setColor(255, 255, 255) + someUnit:draw() + drawText('Hellorld!', 160, 100) if mouseState == 2 then diff --git a/game/res/unit.png b/game/res/unit.png new file mode 100644 index 0000000000000000000000000000000000000000..a41a33efb3915f353822cab5d0101ca26dfebacd GIT binary patch literal 217 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!73?$#)eFPF`gx!V#*!evUqPdALld_Ff*8~RomaA6|)j(34^Dr KpUXO@geCy0