initial
This commit is contained in:
commit
68a7553720
127
main.lua
Normal file
127
main.lua
Normal file
@ -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
|
BIN
question1.png
Normal file
BIN
question1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 B |
BIN
question2.png
Normal file
BIN
question2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 621 B |
BIN
question3.png
Normal file
BIN
question3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 665 B |
Loading…
x
Reference in New Issue
Block a user