Fixed the garbage pausing problem in Phantom Mania 2.

This commit is contained in:
Joe Zeng 2020-11-07 01:12:13 -05:00
parent 28b455fcc0
commit 91a87fea73
4 changed files with 34 additions and 27 deletions

View File

@ -33,6 +33,8 @@ blocks = {
C = love.graphics.newImage("res/img/s2.png"), C = love.graphics.newImage("res/img/s2.png"),
B = love.graphics.newImage("res/img/s4.png"), B = love.graphics.newImage("res/img/s4.png"),
M = love.graphics.newImage("res/img/s5.png"), M = love.graphics.newImage("res/img/s5.png"),
F = love.graphics.newImage("res/img/s9.png"),
A = love.graphics.newImage("res/img/s9.png"),
X = love.graphics.newImage("res/img/s9.png"), X = love.graphics.newImage("res/img/s9.png"),
}, },
["bone"] = { ["bone"] = {
@ -43,6 +45,8 @@ blocks = {
C = love.graphics.newImage("res/img/bone.png"), C = love.graphics.newImage("res/img/bone.png"),
B = love.graphics.newImage("res/img/bone.png"), B = love.graphics.newImage("res/img/bone.png"),
M = love.graphics.newImage("res/img/bone.png"), M = love.graphics.newImage("res/img/bone.png"),
F = love.graphics.newImage("res/img/bone.png"),
A = love.graphics.newImage("res/img/bone.png"),
X = love.graphics.newImage("res/img/bone.png"), X = love.graphics.newImage("res/img/bone.png"),
} }
} }

View File

@ -4,7 +4,7 @@ local Grid = Object:extend()
local empty = { skin = "", colour = "" } local empty = { skin = "", colour = "" }
local oob = { skin = "", colour = "" } local oob = { skin = "", colour = "" }
local block = { skin = "2tie", colour = "X" } local block = { skin = "2tie", colour = "A" }
function Grid:new() function Grid:new()
self.grid = {} self.grid = {}
@ -170,6 +170,7 @@ function Grid:applyFourWide()
x[10] = x[10]~=block and block or x[10] x[10] = x[10]~=block and block or x[10]
end end
end end
function Grid:applyPiece(piece) function Grid:applyPiece(piece)
if piece.big then if piece.big then
self:applyBigPiece(piece) self:applyBigPiece(piece)
@ -263,7 +264,7 @@ function Grid:draw()
for y = 5, 24 do for y = 5, 24 do
for x = 1, 10 do for x = 1, 10 do
if self.grid[y][x] ~= empty then if self.grid[y][x] ~= empty then
if self.grid_age[y][x] < 1 then if self.grid_age[y][x] < 2 then
love.graphics.setColor(1, 1, 1, 1) love.graphics.setColor(1, 1, 1, 1)
love.graphics.draw(blocks[self.grid[y][x].skin]["F"], 48+x*16, y*16) love.graphics.draw(blocks[self.grid[y][x].skin]["F"], 48+x*16, y*16)
else else
@ -297,7 +298,7 @@ function Grid:drawInvisible(opacity_function, garbage_opacity_function)
if self.grid[y][x] ~= empty then if self.grid[y][x] ~= empty then
if self.grid[y][x].colour == "X" then if self.grid[y][x].colour == "X" then
opacity = 1 opacity = 1
elseif garbage_opacity_function and self.grid[y][x].colour == "G" then elseif garbage_opacity_function and self.grid[y][x].colour == "A" then
opacity = garbage_opacity_function(self.grid_age[y][x]) opacity = garbage_opacity_function(self.grid_age[y][x])
else else
opacity = opacity_function(self.grid_age[y][x]) opacity = opacity_function(self.grid_age[y][x])

View File

@ -16,6 +16,7 @@ SurvivalA3Game.tagline = "The blocks turn black and white! Can you make it to le
function SurvivalA3Game:new() function SurvivalA3Game:new()
SurvivalA3Game.super:new() SurvivalA3Game.super:new()
self.level = 0
self.grade = 0 self.grade = 0
self.garbage = 0 self.garbage = 0
self.clear = false self.clear = false

View File

@ -32,30 +32,31 @@ function TGMPlusGame:new()
self.garbage_queue = 0 self.garbage_queue = 0
self.garbage_pos = 0 self.garbage_pos = 0
self.garbage_rows = { self.garbage_rows = {
[0] = {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"}, [0] =
{"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"}, {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"},
{"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"}, {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"},
{"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"}, {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"}, {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"}, {"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"},
{"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"}, {"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"},
{"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"}, {"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"},
{"e", "e", "b", "b", "b", "b", "b", "b", "b", "b"}, {"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"},
{"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"}, {"e", "e", "b", "b", "b", "b", "b", "b", "b", "b"},
{"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"}, {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "b", "e", "e"}, {"e", "b", "b", "b", "b", "b", "b", "b", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"}, {"b", "b", "b", "b", "b", "b", "b", "b", "e", "e"},
{"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"}, {"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"},
{"b", "b", "e", "b", "b", "b", "b", "b", "b", "b"}, {"b", "b", "b", "b", "b", "b", "b", "b", "b", "e"},
{"b", "e", "e", "b", "b", "b", "b", "b", "b", "b"}, {"b", "b", "e", "b", "b", "b", "b", "b", "b", "b"},
{"b", "e", "b", "b", "b", "b", "b", "b", "b", "b"}, {"b", "e", "e", "b", "b", "b", "b", "b", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "e", "b", "b"}, {"b", "e", "b", "b", "b", "b", "b", "b", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "e", "e", "b"}, {"b", "b", "b", "b", "b", "b", "b", "e", "b", "b"},
{"b", "b", "b", "b", "b", "b", "b", "b", "e", "b"}, {"b", "b", "b", "b", "b", "b", "b", "e", "e", "b"},
{"b", "b", "b", "b", "e", "e", "b", "b", "b", "b"}, {"b", "b", "b", "b", "b", "b", "b", "b", "e", "b"},
{"b", "b", "b", "b", "e", "e", "b", "b", "b", "b"}, {"b", "b", "b", "b", "e", "e", "b", "b", "b", "b"},
{"b", "b", "b", "b", "e", "b", "b", "b", "b", "b"}, {"b", "b", "b", "b", "e", "e", "b", "b", "b", "b"},
{"b", "b", "b", "e", "e", "e", "b", "b", "b", "b"}, {"b", "b", "b", "b", "e", "b", "b", "b", "b", "b"},
{"b", "b", "b", "e", "e", "e", "b", "b", "b", "b"},
} }
end end