summaryrefslogtreecommitdiff
path: root/game/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'game/init.lua')
-rw-r--r--game/init.lua16
1 files changed, 11 insertions, 5 deletions
diff --git a/game/init.lua b/game/init.lua
index 689da31..d6d9144 100644
--- a/game/init.lua
+++ b/game/init.lua
@@ -55,8 +55,9 @@ function M:input_loop()
while self.piece:move(-1, 0) do did_move = true end
if did_move then evloop.queue "game.lock_cancel" end
elseif key == "up" then
- self.piece:rotate()
- evloop.queue "game.lock_cancel"
+ if self.piece:rotate() then
+ evloop.queue "game.lock_cancel"
+ end
elseif key == "space" then
local dropped = false
while self.piece:move(-1, 0) do
@@ -86,9 +87,14 @@ function M:input_loop()
end
function M:place_piece()
- self.piece:place()
- self.piece = nil
- evloop.queue "game.lock_cancel"
+ if not self.piece:can_move(-1, 0) then
+ self.piece:place()
+ self.piece = nil
+ evloop.queue "game.lock_cancel"
+ return true
+ else
+ return false
+ end
end
function M:next_piece()