From 3432f5d36e4b5642a6c75697b546d698ac237f4d Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Wed, 22 Feb 2023 21:06:16 +0100 Subject: [PATCH] Variable board size --- 0hh1.p8 | 6 +++--- board.lua | 4 ++-- globals.lua | 1 + states/menu.lua | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/0hh1.p8 b/0hh1.p8 index 41dfa70..a4539a4 100644 --- a/0hh1.p8 +++ b/0hh1.p8 @@ -1,5 +1,5 @@ pico-8 cartridge // http://www.pico-8.com -version 36 +version 38 __lua__ @@ -60,8 +60,8 @@ __gfx__ cc0cc01101100cc0cc08801100110110110110011011011011001101101101100880110110110011011011011001101101101100000000000000000000000000 cc0cc01101100cc0cc08801100110110110110011011011011001101101101100880110110110011011011011001101101101100000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 -1101101101100110110110110011011088011001101108801100880880cc01100880880cc0cc00cc0880cc08800cc0880cc08800000000000000000000000000 -1101101101100110110110110011011088011001101108801100880880cc01100880880cc0cc00cc0880cc08800cc0880cc08800000000000000000000000000 +1101101101100110110110110011011088011001101108801100880880cc01100880880cc0cc0011011011011001101101101100000000000000000000000000 +1101101101100110110110110011011088011001101108801100880880cc01100880880cc0cc0011011011011001101101101100000000000000000000000000 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 110110110110011011011011001101101101100110110cc01100cc01101101100cc01101101100110cc08801100cc0cc08808800000000000000000000000000 110110110110011011011011001101101101100110110cc01100cc01101101100cc01101101100110cc08801100cc0cc08808800000000000000000000000000 diff --git a/board.lua b/board.lua index 468e502..d1e72a1 100644 --- a/board.lua +++ b/board.lua @@ -2,8 +2,8 @@ local Board = {} function Board.new() local debug = false - local width = 4 -- tiles - local tile_width = 10 -- pixels + local width = board_size -- tiles + local tile_width = 8 -- pixels local padding = 1 local tiles = {} local locked = {} -- list of indexes diff --git a/globals.lua b/globals.lua index 830003f..29e8838 100644 --- a/globals.lua +++ b/globals.lua @@ -1,6 +1,7 @@ local amplitude = 128 local mouse_x = 0 local mouse_y = 0 +local board_size = 8 -- -- constants diff --git a/states/menu.lua b/states/menu.lua index 9e84b2c..5e49d9f 100644 --- a/states/menu.lua +++ b/states/menu.lua @@ -19,7 +19,7 @@ function state_menu() make_button({ x=10, y=10+k*10, w=200, text=item[1], data={i=2}, - on_click=function() set_state(states.rules) end, + on_click=function() board_size=item[2] set_state(states.loading) end, on_hover=function(btn) selected=k+1 end, }) )