mirror of
https://github.com/SashLilac/cambridge.git
synced 2025-05-13 20:21:25 -05:00
Compare commits
3 Commits
v0.3-beta5
...
v0.3-beta5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e1741440f2 | ||
|
|
c56f290921 | ||
|
|
86e975f929 |
@@ -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
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
version = "v0.3-beta5.1"
|
version = "v0.3-beta5.2"
|
||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user