diff options
author | heav <hheav3@gmail.com> | 2023-03-27 07:08:34 +0000 |
---|---|---|
committer | heav <hheav3@gmail.com> | 2023-03-27 07:08:34 +0000 |
commit | b3e4771a025057df5673e0caf393516a9b61665a (patch) | |
tree | c76efc4203a8dcb2d39213b81e270c689323d9fb | |
parent | 8b6d7690c1bad22af49da31954ae4929dad5a9df (diff) | |
parent | bed01abdb735b9182f02b02bc2a1cf480ff46214 (diff) |
Merge branch 'master' of citrons:polyflux
-rw-r--r-- | LICENSE.txt | 19 | ||||
-rw-r--r-- | game/init.lua | 18 |
2 files changed, 29 insertions, 8 deletions
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. diff --git a/game/init.lua b/game/init.lua index a273d31..682025d 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,19 +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 - local did_move = false - while self.piece:move(-1, 0) do did_move = true end - if did_move then evloop.queue "game.lock_cancel" end + 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 @@ -81,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 |