Compare commits

..

3 Commits

Author SHA1 Message Date
Ishaan Bhardwaj
e1741440f2 Fixed an edge case with the last save commit 2021-05-22 21:42:14 -04:00
Ishaan Bhardwaj
c56f290921 Fixed a bug where the game would sometimes not save on macOS
Version bump to beta5.2
2021-05-22 21:19:33 -04:00
Ishaan Bhardwaj
86e975f929 Fixed up an edge case in immobile spin 2021-05-22 14:41:51 -04:00
3 changed files with 24 additions and 10 deletions

View File

@@ -1,8 +1,17 @@
local binser = require 'libs.binser' local binser = require 'libs.binser'
function loadSave() function loadSave()
config = loadFromFile('config.sav') local info = love.filesystem.getInfo(love.filesystem.getSaveDirectory())
highscores = loadFromFile('highscores.sav') if not info or info.type ~= "directory" then
love.filesystem.remove(love.filesystem.getSaveDirectory())
love.filesystem.createDirectory(love.filesystem.getSaveDirectory())
end
config = loadFromFile(
love.filesystem.getSaveDirectory() .. '/config.sav'
)
highscores = loadFromFile(
love.filesystem.getSaveDirectory() .. '/highscores.sav'
)
end end
function loadFromFile(filename) function loadFromFile(filename)
@@ -40,9 +49,13 @@ function initConfig()
end end
function saveConfig() function saveConfig()
binser.writeFile('config.sav', config) binser.writeFile(
love.filesystem.getSaveDirectory() .. '/config.sav', config
)
end end
function saveHighscores() function saveHighscores()
binser.writeFile('highscores.sav', highscores) binser.writeFile(
love.filesystem.getSaveDirectory() .. '/highscores.sav', highscores
)
end end

View File

@@ -1 +1 @@
version = "v0.3-beta5.1" version = "v0.3-beta5.2"

View File

@@ -206,14 +206,14 @@ function GameMode:update(inputs, ruleset)
self.piece.last_rotated = false self.piece.last_rotated = false
self:onPieceMove(self.piece, self.grid, piece_dx) self:onPieceMove(self.piece, self.grid, piece_dx)
end end
if (piece_drot ~= 0) then
self.piece.last_rotated = true
self:onPieceRotate(self.piece, self.grid, piece_drot)
end
if (piece_dy ~= 0) then if (piece_dy ~= 0) then
self.piece.last_rotated = false self.piece.last_rotated = false
self:onPieceDrop(self.piece, self.grid, piece_dy) self:onPieceDrop(self.piece, self.grid, piece_dy)
end end
if (piece_drot ~= 0) then
self.piece.last_rotated = true
self:onPieceRotate(self.piece, self.grid, piece_drot)
end
if inputs["up"] == true and if inputs["up"] == true and
self.piece:isDropBlocked(self.grid) and self.piece:isDropBlocked(self.grid) and
@@ -242,7 +242,8 @@ function GameMode:update(inputs, ruleset)
if self.piece.locked == true then if self.piece.locked == true then
-- spin detection, immobile only for now -- spin detection, immobile only for now
if self.immobile_spin_bonus and ( if self.immobile_spin_bonus and
self.piece.last_rotated and (
self.piece:isDropBlocked(self.grid) and self.piece:isDropBlocked(self.grid) and
self.piece:isMoveBlocked(self.grid, { x=-1, y=0 }) and self.piece:isMoveBlocked(self.grid, { x=-1, y=0 }) and
self.piece:isMoveBlocked(self.grid, { x=1, y=0 }) and self.piece:isMoveBlocked(self.grid, { x=1, y=0 }) and