From 062ea9e6e0cdb78498904b1dbb9f03ee262e5913 Mon Sep 17 00:00:00 2001 From: PeaAshMeter Date: Mon, 11 Aug 2025 03:04:39 +0300 Subject: [PATCH] fix epilepsy --- main.lua | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/main.lua b/main.lua index 1fe9e57..7b76f2d 100644 --- a/main.lua +++ b/main.lua @@ -9,12 +9,21 @@ function love.conf(t) t.console = true end +local width = 30 +local height = 30 function love.load() local char = character.spawn("Hero", "warrior", Tree.assets.files.sprites.character) char:runTo(Vec3 { 5, 5 }) Grass = Tree.assets.files.tiles.grass.atlas Gr1 = love.graphics.newQuad(0, 32, 32, 32, Grass) + Tilemap = {} + for y = 0, height - 1 do + Tilemap[y] = {} + for x = 0, width - 1 do + Tilemap[y][x] = love.graphics.newQuad(math.random(0, 7) * 32, math.random(0, 7) * 32, 32, 32, Grass) + end + end -- PlayerFaction.characters = { Hero1, Hero2 } love.window.setMode(1080, 720, { resizable = true, msaa = 4, vsync = true }) @@ -30,12 +39,9 @@ end function love.draw() Tree.level.camera:attach() - local width = 30 - local height = 30 - for y = 0, height - 1 do for x = 0, width - 1 do - love.graphics.draw(Grass, love.graphics.newQuad(math.random(0, 32), math.random(0, 32), 32, 32, Grass), x, y, + love.graphics.draw(Grass, Tilemap[x][y], x, y, nil, 1 / 32, 1 / 32) end end