diff options
author | heav <hheav3@gmail.com> | 2023-03-26 22:31:21 +0000 |
---|---|---|
committer | heav <hheav3@gmail.com> | 2023-03-26 22:31:21 +0000 |
commit | 9bdb5bc1ffb2081dd59a2191e3028b9ecea8eafc (patch) | |
tree | 858b64172ecb414f879aa95f5f0fec6f9a6d322a | |
parent | dde916c63936849e0886f6ccdecbfaff794aa545 (diff) |
made the game 34561x more optimal.
-rw-r--r-- | game/init.lua | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/game/init.lua b/game/init.lua index ec4edd3..d3d64a8 100644 --- a/game/init.lua +++ b/game/init.lua @@ -3,6 +3,7 @@ local playfield = require "game.playfield" local tetrominoes = require "game.tetrominoes" local heav_optimal_shapes = require "game.heav_optimal_shapes" local gfx = require "game.gfx" +local sfx = require "game.sfx" local bag = require "game.bag" local M = {} @@ -52,8 +53,12 @@ function M:input_loop() elseif key == "up" then self.piece:rotate() elseif key == "space" then - repeat until not self.piece:move(-1, 0) + local dropped = false + while self.piece:move(-1, 0) do + dropped = true + end self.piece:place() + if dropped then sfx.play("harddrop") end elseif key == "c" then if not self.can_hold then goto bypass end if not self.hold then |