Commit before fixes

This commit is contained in:
2022-07-01 19:50:08 +02:00
parent 6d1f8bbc8b
commit 0276d70de3
5 changed files with 42 additions and 24 deletions
+7 -2
View File
@@ -3,7 +3,7 @@ function state_game()
local board
local selected_id = 1
local function drawSelectedTile()
local function draw_selected_tile()
local x, y = board:draw_coords(selected_id)
local w = board:get_tile_width()
fillp(▒)
@@ -20,7 +20,7 @@ function state_game()
local function _draw()
cls()
board:draw()
drawSelectedTile()
draw_selected_tile()
end
local function _update()
@@ -35,6 +35,11 @@ function state_game()
elseif btnp(RIGHT) then
x += 1
end
if btnp(BTN_O) then
board:try_flip_tile(selected_id)
end
if (x<1) x=size
if (x>size) x=1
if (y<1) y=size
+5 -4
View File
@@ -37,14 +37,15 @@ function state_loading()
-- Remove tiles that can be removed
local previous = {board:get_tiles_copy()} -- initial state
local size = board:get_size()*board:get_size()
while true do
board:set_tiles(previous[#previous])
-- remove a random tile
repeat
removing_tile += 1
until removing_tile == 100 or board:get_tiles_copy()[removing_tile] ~= 0
if removing_tile == 100 then
until removing_tile == size or board:get_tiles_copy()[removing_tile] ~= 0
if removing_tile == size then
break
end
@@ -111,9 +112,9 @@ function state_loading()
cls()
board:draw_bg()
draw_tiles(board)
local s = board:get_size()*board:get_size()
local l = print(message, 0, -100)
local y = 118+removing_tile/8
local y = 118+(removing_tile/s)*100/8
local colors = {7,6,5,5}
local ci = removing_tile\20+1
local c = colors[ci]