From 02fbe198d4aea2669d9a0b400fe5a5f622f14a58 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Sat, 24 Sep 2022 16:07:41 +0200 Subject: [PATCH] Fixed new board state --- states/loading.lua | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/states/loading.lua b/states/loading.lua index 96ea0b3..d796eff 100644 --- a/states/loading.lua +++ b/states/loading.lua @@ -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()