commit 68a7553720c38f75f2d64f7638579fdb3303ecb2 Author: Zack Buhman Date: Thu Jun 15 16:31:21 2023 +0000 initial diff --git a/brick.png b/brick.png new file mode 100644 index 0000000..65416be Binary files /dev/null and b/brick.png differ diff --git a/main.lua b/main.lua new file mode 100644 index 0000000..a7b6c87 --- /dev/null +++ b/main.lua @@ -0,0 +1,127 @@ +question = {} + +function love.load() + love.graphics.setDefaultFilter("nearest") + + brick_image = love.graphics.newImage("brick.png", nil) + for i=1,3 do + question[i] = love.graphics.newImage("question" .. i .. ".png", nil) + end + + quad = love.graphics.newQuad(0, 0, 16, 16, brick_image:getDimensions()) +end + +brick_frame = 1 +brick_state = 0 +brick_dir = 1 + +function love.update(dt) + brick_state = brick_state + dt + if (brick_state > 0.15) then + brick_state = 0 + + if brick_frame == 3 and brick_dir == 0 then brick_dir = -1 + elseif brick_frame == 3 then brick_dir = 0 end + + if brick_frame == 1 then brick_dir = 1 end + + brick_frame = brick_frame + brick_dir + end + +end + +T = { + BRICK = 1, + QUESTION = 2, +} + +function b(x, t) + local t1 = { + {1 + x, 4, T.QUESTION}, + {2 + x, 4, T.QUESTION}, + {3 + x, 4, T.QUESTION}, + {4 + x, 5, T.QUESTION}, + {4 + x, 6, T.QUESTION}, + {3 + x, 7, T.QUESTION}, + {2 + x, 7, T.QUESTION}, + {1 + x, 7, T.QUESTION}, + {1 + x, 6, T.QUESTION}, + {1 + x, 5, T.QUESTION}, + {1 + x, 8, T.QUESTION}, + {1 + x, 9, T.QUESTION}, + {2 + x, 10, T.QUESTION}, + {3 + x, 10, T.QUESTION}, + {4 + x, 9, T.QUESTION}, + {4 + x, 8, T.QUESTION}, + } + for i=1,#t1 do + t[#t+1] = t1[i] + end +end + +function n(x, t) + local t1 = { + {1 + x, 4, T.QUESTION}, + {1 + x, 5, T.QUESTION}, + {1 + x, 6, T.QUESTION}, + {1 + x, 7, T.QUESTION}, + {1 + x, 8, T.QUESTION}, + {1 + x, 9, T.QUESTION}, + {1 + x, 10, T.QUESTION}, + + + {2 + x, 8, T.QUESTION}, + {2 + x, 7, T.QUESTION}, + {3 + x, 6, T.QUESTION}, + {3 + x, 5, T.QUESTION}, + + {4 + x, 4, T.QUESTION}, + {4 + x, 5, T.QUESTION}, + {4 + x, 6, T.QUESTION}, + {4 + x, 7, T.QUESTION}, + {4 + x, 8, T.QUESTION}, + {4 + x, 9, T.QUESTION}, + {4 + x, 10, T.QUESTION}, + } + for i=1,#t1 do + t[#t+1] = t1[i] + end +end + +function love.draw() + width, height = love.graphics.getDimensions() + + -- 600 - 48 + local scale = 3 + love.graphics.scale(scale, scale) + + bricks = { + {1, 0, T.BRICK}, + {2, 0, T.BRICK}, + {4, 0, T.BRICK}, + {5, 0, T.BRICK}, + } + + b(0, bricks) + n(5, bricks) + b(10, bricks) + + -- blue 8a84ff + love.graphics.clear(0x8a / 255, 0x84 / 255, 0xff / 255) + + -- 48 px + for i=1,#bricks do + local image + if bricks[i][3] == T.BRICK then + image = brick_image + elseif bricks[i][3] == T.QUESTION then + image = question[brick_frame] + else + image = nil + end + + love.graphics.draw(image, quad, + bricks[i][1] * 16, + (height / scale) - (16 * (bricks[i][2] + 1))) + end +end diff --git a/question1.png b/question1.png new file mode 100644 index 0000000..235ebf2 Binary files /dev/null and b/question1.png differ diff --git a/question2.png b/question2.png new file mode 100644 index 0000000..c797e30 Binary files /dev/null and b/question2.png differ diff --git a/question3.png b/question3.png new file mode 100644 index 0000000..97bcbbf Binary files /dev/null and b/question3.png differ