Fixed new board state

This commit is contained in:
Simon Cambier 2022-09-24 16:07:41 +02:00
parent 31f6b7c3e3
commit 02fbe198d4

View File

@ -1,5 +1,8 @@
function state_loading()
local board = Board.new()
local board
local size
local og_rt
local removing_tile
local spinner = split"-,\\,|,/"
local loading_messages = {
@ -26,11 +29,8 @@ function state_loading()
local loaded = false
local done = {}
local size = board:get_size()*board:get_size()
local og_rt = rnd(size)\1+1 -- original removing tile
local removing_tile = og_rt
local create_board = cocreate(function()
local create_board = function()
printh("creating")
local start = time()
repeat
board:reset()
@ -88,7 +88,7 @@ function state_loading()
printh(count(board:get_tiles_copy(), 0).." zeroes")
loaded = true
end)
end
local function draw_tiles(board)
local w = board:get_size()
@ -101,8 +101,15 @@ function state_loading()
end
local function _enter()
printh("enter loading")
board = Board:new()
size = board:get_size()*board:get_size()
og_rt = rnd(size)\1+1 -- original removing tile
removing_tile = og_rt
amplitude = 64
loaded = false
done = {}
local copy_messages = copy(loading_messages)
messages_str = ""
@ -114,7 +121,7 @@ function state_loading()
end
messages_str ..= "tHANK YOU FOR YOUR PATIENCE"
startcoroutine(create_board)
startcoroutine(cocreate(create_board))
end
local function _update()