From 4df34ed536fc687edcb386bb3823dc43d5c8c2e8 Mon Sep 17 00:00:00 2001 From: the lemons Date: Mon, 27 Mar 2023 01:10:30 -0500 Subject: toggleable infinity --- game/init.lua | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/game/init.lua b/game/init.lua index 9872a4c..4cc48f2 100644 --- a/game/init.lua +++ b/game/init.lua @@ -28,6 +28,7 @@ function M.new(params) new.gfx = gfx.new(new) new.gravity_delay = 0.5 new.lock_delay = params.lock_delay or 0.5 + new.infinity = params.infinity or false new.bag = bag.new(pieces, {seed = os.time(), randomly_add = { [heav_optimal_shapes.heav] = {inverse_chance = 5000}, [heav_optimal_shapes.spite_shape] = {inverse_chance = 10000}, @@ -45,17 +46,16 @@ function M:input_loop() return loop() end + local moved if e == "keypressed" then if key == "left" then - self.piece:move(0, -1) + moved = self.piece:move(0, -1) elseif key == "right" then - self.piece:move(0, 1) + moved = self.piece:move(0, 1) elseif key == "down" then - self.piece:move(-1, 0) + moved = self.piece:move(-1, 0) elseif key == "up" then - if self.piece:rotate() then - evloop.queue "game.lock_cancel" - end + moved = self.piece:rotate() elseif key == "space" then local dropped = false while self.piece:move(-1, 0) do @@ -79,6 +79,10 @@ function M:input_loop() end end + if moved and self.infinity then + evloop.queue "game.lock_cancel" + end + return loop() end return loop -- cgit v1.2.3 From bed01abdb735b9182f02b02bc2a1cf480ff46214 Mon Sep 17 00:00:00 2001 From: the lemons Date: Mon, 27 Mar 2023 01:12:39 -0500 Subject: license --- LICENSE.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 LICENSE.txt diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..9e811ba --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,19 @@ +Copyright © 2023 heav, citrons + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the “Software”), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. -- cgit v1.2.3