Compare commits

..

2 Commits

Author SHA1 Message Date
Ishaan Bhardwaj
2818fcf50b Update black colored blocks in Minesweeper 2021-09-21 23:34:04 -04:00
Ishaan Bhardwaj
504e9f5bd4 Updated modpack for graphics commit in main game 2021-09-21 23:29:45 -04:00
12 changed files with 43 additions and 94 deletions

View File

@ -349,7 +349,7 @@ function LifeGrid:markSquares()
elseif i == 2 then elseif i == 2 then
for j = 0, 3 do for j = 0, 3 do
for k = 0, 3 do for k = 0, 3 do
self.grid[y+j][x+k].colour = "F" self.grid[y+j][x+k].colour = "W"
self.grid[y+j][x+k].skin = "square" self.grid[y+j][x+k].skin = "square"
end end

View File

@ -363,7 +363,7 @@ function StrategyGrid:markSquares()
elseif i == 2 then elseif i == 2 then
for j = 0, 3 do for j = 0, 3 do
for k = 0, 3 do for k = 0, 3 do
self.grid[y+j][x+k].colour = "F" self.grid[y+j][x+k].colour = "W"
self.grid[y+j][x+k].skin = "square" self.grid[y+j][x+k].skin = "square"
end end

View File

@ -57,7 +57,7 @@ end
function CreditsA3Game:onLineClear(cleared_row_count) function CreditsA3Game:onLineClear(cleared_row_count)
if not self.clear then if not self.clear then
self.norm = self.norm + (cleared_row_count == 4 and 10 or cleared_row_count) self.norm = self.norm + cleared_row_count + (cleared_row_count >= 4 and 6 or 0)
end end
end end
@ -84,12 +84,14 @@ function CreditsA3Game:drawScoringInfo()
strTrueValues(self.prev_inputs) strTrueValues(self.prev_inputs)
) )
love.graphics.printf("NEXT", 64, 40, 40, "left") love.graphics.printf("NEXT", 64, 40, 40, "left")
love.graphics.printf("ROLLS COMPLETED", 240, 170, 120, "left")
love.graphics.printf("TIME LEFT", 240, 250, 80, "left") love.graphics.printf("TIME LEFT", 240, 250, 80, "left")
love.graphics.printf("NORM", 240, 320, 40, "left") love.graphics.printf("NORM", 240, 320, 40, "left")
self:drawSectionTimesWithSplits(self.section)
love.graphics.setFont(font_3x5_3) love.graphics.setFont(font_3x5_3)
love.graphics.printf(self.section, 240, 190, 160, "left")
-- draw time left, flash red if necessary -- draw time left, flash red if necessary
local time_left = self.section_time_limit - math.max(self:getSectionTime(), 0) local time_left = self.section_time_limit - math.max(self:getSectionTime(), 0)
@ -113,7 +115,7 @@ function CreditsA3Game:drawScoringInfo()
end end
function CreditsA3Game:getBackground() function CreditsA3Game:getBackground()
return self.section return self.section % 20
end end
return CreditsA3Game return CreditsA3Game

View File

@ -2033,7 +2033,7 @@ local function parseMap(str, map)
elseif char == "Z" then elseif char == "Z" then
insert_this = { skin = "2tie", colour = "R" } insert_this = { skin = "2tie", colour = "R" }
elseif char == "C" then elseif char == "C" then
insert_this = { skin = "gem", colour = "F" } insert_this = { skin = "gem", colour = "W" }
end end
row_array[col] = insert_this row_array[col] = insert_this
end end

View File

@ -93,8 +93,8 @@ end
function Minesweeper:mainGameLoop(inputs) function Minesweeper:mainGameLoop(inputs)
self:moveCursor(inputs) self:moveCursor(inputs)
if not self.prev_inputs.rotate_left and inputs.rotate_left and if not self.prev_inputs.rotate_left and inputs.rotate_left and
self.grid.grid[self.cursor.y+4][self.cursor.x].colour ~= "F" and self.grid.grid[self.cursor.y+4][self.cursor.x].colour ~= "W" and
self.grid.grid[self.cursor.y+4][self.cursor.x].colour ~= "A" then self.grid.grid[self.cursor.y+4][self.cursor.x].colour ~= "D" then
playSE("lock") playSE("lock")
if not self:isMine(self.cursor.x, self.cursor.y) then if not self:isMine(self.cursor.x, self.cursor.y) then
self:uncoverCell(self.cursor.x, self.cursor.y) self:uncoverCell(self.cursor.x, self.cursor.y)
@ -114,7 +114,7 @@ function Minesweeper:updateFlagCount()
local flags = math.floor(0.15 * width * height) local flags = math.floor(0.15 * width * height)
for y = 5, height + 4 do for y = 5, height + 4 do
for x = 1, width do for x = 1, width do
if self.grid.grid[y][x].colour == "A" then if self.grid.grid[y][x].colour == "D" then
flags = flags - 1 flags = flags - 1
end end
end end
@ -136,9 +136,9 @@ end
function Minesweeper:flagCell(x, y) function Minesweeper:flagCell(x, y)
if self.flags > 0 and self.grid.grid[y+4][x].skin == "2tie" and if self.flags > 0 and self.grid.grid[y+4][x].skin == "2tie" and
self.grid.grid[y+4][x].colour ~= "F" then self.grid.grid[y+4][x].colour ~= "W" then
self.grid.grid[y+4][x] = { self.grid.grid[y+4][x] = {
skin = "gem", colour = "A" skin = "gem", colour = "D"
} }
elseif self.grid.grid[y+4][x].skin == "gem" then elseif self.grid.grid[y+4][x].skin == "gem" then
self.grid.grid[y+4][x] = { self.grid.grid[y+4][x] = {
@ -165,7 +165,7 @@ function Minesweeper:uncoverCell(x, y)
local x = current.x local x = current.x
local y = current.y local y = current.y
self.grid.grid[y+4][x] = { skin = "2tie", colour = "F" } self.grid.grid[y+4][x] = { skin = "2tie", colour = "W" }
if self:getSurroundingMineCount(x, y) == 0 then if self:getSurroundingMineCount(x, y) == 0 then
for dy = -1, 1 do for dy = -1, 1 do
@ -173,7 +173,7 @@ function Minesweeper:uncoverCell(x, y)
if not (dx == 0 and dy == 0) and if not (dx == 0 and dy == 0) and
x+dx >= 1 and x+dx <= width and x+dx >= 1 and x+dx <= width and
y+dy >= 1 and y+dy <= height and y+dy >= 1 and y+dy <= height and
self.grid.grid[y+4+dy][x+dx].colour ~= "F" self.grid.grid[y+4+dy][x+dx].colour ~= "W"
then then
table.insert(stack, { table.insert(stack, {
x = x + dx, x = x + dx,
@ -187,7 +187,7 @@ function Minesweeper:uncoverCell(x, y)
for y = 5, height + 4 do for y = 5, height + 4 do
for x = 1, width do for x = 1, width do
if self.grid.grid[y][x].colour ~= "F" and if self.grid.grid[y][x].colour ~= "W" and
not self:isMine(x, y-4) then not self:isMine(x, y-4) then
return return
end end
@ -215,7 +215,7 @@ function Minesweeper:onGameOver()
if self:isMine(x, y-4) then if self:isMine(x, y-4) then
self.grid.grid[y][x] = { skin = "gem", colour = "R" } self.grid.grid[y][x] = { skin = "gem", colour = "R" }
else else
self.grid.grid[y][x] = { skin = "2tie", colour = "F" } self.grid.grid[y][x] = { skin = "2tie", colour = "W" }
end end
end end
end end
@ -233,7 +233,7 @@ function Minesweeper:onGameComplete()
end end
local function opacityFunction(game, block, x, y, age) local function opacityFunction(game, block, x, y, age)
if block.colour == "F" then if block.colour == "W" then
return 0.5, 0.5, 0.5, 1, 1 return 0.5, 0.5, 0.5, 1, 1
else else
return 1, 1, 1, 1, 1 return 1, 1, 1, 1, 1
@ -251,7 +251,7 @@ function Minesweeper:drawGrid()
love.graphics.rectangle("line", 48+x*16, y*16, 16, 16) love.graphics.rectangle("line", 48+x*16, y*16, 16, 16)
end end
if self:getSurroundingMineCount(x, y-4) ~= 0 and if self:getSurroundingMineCount(x, y-4) ~= 0 and
self.grid.grid[y][x].colour == "F" then self.grid.grid[y][x].colour == "W" then
love.graphics.print(self:getSurroundingMineCount(x, y-4), 50+x*16, -2+y*16) love.graphics.print(self:getSurroundingMineCount(x, y-4), 50+x*16, -2+y*16)
end end
end end

View File

@ -75,7 +75,7 @@ function SurvivalAXHGame:drawGrid()
if self:getHiddenDelay() then if self:getHiddenDelay() then
for i = 1, self.hidden_rows do for i = 1, self.hidden_rows do
for j = 1, 10 do for j = 1, 10 do
love.graphics.draw(blocks["2tie"]["F"], 48+j*16, (24-i+1)*16) love.graphics.draw(blocks["2tie"]["W"], 48+j*16, (24-i+1)*16)
end end
end end
end end

View File

@ -24,7 +24,7 @@ function SurvivalGTEGame:getGravity() return 20 end
function SurvivalGTEGame:getARR() return 2 end function SurvivalGTEGame:getARR() return 2 end
function SurvivalGTEGame:getDasLimit() function SurvivalGTEGame:getDasLimit()
return math.min(self:getLockDelay() - 2, 10) return math.min(math.floor(self:getLockDelay() * 2/3), 10)
end end
function SurvivalGTEGame:getLockDelay() function SurvivalGTEGame:getLockDelay()
@ -51,8 +51,8 @@ function SurvivalGTEGame:getLineClearDelay()
end end
function SurvivalGTEGame:onLineClear(cleared_row_count) function SurvivalGTEGame:onLineClear(cleared_row_count)
self.lines = math.min(self.lines + cleared_row_count, 300) self.lines = self.lines + cleared_row_count
self.completed = self.lines == 300 self.completed = self.lines >= 300
end end
function SurvivalGTEGame:advanceOneFrame() function SurvivalGTEGame:advanceOneFrame()

View File

@ -10,7 +10,7 @@ Cultris.colourscheme = {
L = "M", L = "M",
J = "B", J = "B",
S = "C", S = "C",
Z = "F", Z = "W",
O = "Y", O = "Y",
T = "R", T = "R",
} }

View File

@ -6,7 +6,7 @@ EARS.name = "E.A.R.S."
EARS.hash = "EARS" EARS.hash = "EARS"
EARS.colourscheme = { EARS.colourscheme = {
I = "F", I = "W",
J = "G", J = "G",
L = "R", L = "R",
O = "C", O = "C",

View File

@ -1,3 +1,5 @@
-- thanks Adventium_ for heavily un-spaghetti-ing this code
local Ruleset = require 'tetris.rulesets.ruleset' local Ruleset = require 'tetris.rulesets.ruleset'
local Piece = require 'tetris.components.piece' local Piece = require 'tetris.components.piece'
@ -28,7 +30,7 @@ function RandomPieces:generateBlockOffsets()
offsets[i] = generated_offset offsets[i] = generated_offset
end end
return offsets return { { offsets, offsets, offsets, offsets } }
end end
RandomPieces.pieces = 1 RandomPieces.pieces = 1
@ -46,69 +48,23 @@ RandomPieces.next_sounds = {
} }
RandomPieces.colourscheme = { RandomPieces.colourscheme = {
"F" "W"
} }
RandomPieces.block_offsets = { RandomPieces.block_offsets = {
{ {
{ {x=0, y=0} }, { {x=0, y=0} },
{ {x=0, y=0} }, { {x=0, y=0} },
{ {x=0, y=0} }, { {x=0, y=0} },
{ {x=0, y=0} }, { {x=0, y=0} },
} }
} }
function RandomPieces:onPieceCreate(piece) function RandomPieces:onPieceCreate(piece)
local offsets = self:generateBlockOffsets() piece.block_offsets = RandomPieces.generateBlockOffsets()
piece.getBlockOffsets = function()
return offsets
end
piece.withOffset = function(self, offset)
local piece = Piece(
self.shape, self.rotation,
{x = self.position.x + offset.x, y = self.position.y + offset.y},
self.block_offsets, self.gravity, self.lock_delay, self.skin, self.colour, self.big
)
local offsets = self:getBlockOffsets()
piece.getBlockOffsets = function()
return offsets
end
piece.draw = function(self, opacity, brightness, grid, partial_das)
if self.ghost then return false end
if opacity == nil then opacity = 1 end
if brightness == nil then brightness = 1 end
love.graphics.setColor(brightness, brightness, brightness, opacity)
local offsets = self:getBlockOffsets()
local gravity_offset = 0
if config.gamesettings.smooth_movement == 1 and
grid ~= nil and not self:isDropBlocked(grid) then
gravity_offset = self.gravity * 16
end
if partial_das == nil then partial_das = 0 end
for index, offset in pairs(offsets) do
local x = self.position.x + offset.x
local y = self.position.y + offset.y
if self.big then
love.graphics.draw(
blocks[self.skin][self.colour],
64+x*32+partial_das*2, 16+y*32+gravity_offset*2,
0, 2, 2
)
else
love.graphics.draw(
blocks[self.skin][self.colour],
64+x*16+partial_das, 16+y*16+gravity_offset
)
end
end
return false
end
return piece
end
end end
function RandomPieces:attemptRotate(new_inputs, piece, grid, initial) function RandomPieces:attemptRotate(new_inputs, piece, grid, initial)
if not ( if not (
new_inputs.rotate_left or new_inputs.rotate_left2 or new_inputs.rotate_left or new_inputs.rotate_left2 or
new_inputs.rotate_right or new_inputs.rotate_right2 or new_inputs.rotate_right or new_inputs.rotate_right2 or
@ -116,23 +72,14 @@ function RandomPieces:attemptRotate(new_inputs, piece, grid, initial)
) then ) then
return return
end end
local new_piece = piece:withOffset({x=0, y=0}) local new_piece = piece:withOffset({x=0, y=0})
local offsets = self:generateBlockOffsets() new_piece.block_offsets = RandomPieces.generateBlockOffsets()
new_piece.getBlockOffsets = function()
return offsets if (grid:canPlacePiece(new_piece)) then
end piece.block_offsets = new_piece.block_offsets
if (grid:canPlacePiece(new_piece)) then
piece.getBlockOffsets = function()
return offsets
end
self:onPieceRotate(piece, grid) self:onPieceRotate(piece, grid)
else end
if not(initial and self.enable_IRS_wallkicks == false) then
self:attemptWallkicks(piece, new_piece, offsets, grid)
end
end
end end
function RandomPieces:onPieceDrop(piece) piece.lock_delay = 0 end function RandomPieces:onPieceDrop(piece) piece.lock_delay = 0 end

View File

@ -13,7 +13,7 @@ TheNew.colourscheme = {
I = "C", I = "C",
J = "B", J = "B",
L = "M", L = "M",
O = "F", O = "W",
S = "G", S = "G",
Z = "R", Z = "R",
T = "Y" T = "Y"

View File

@ -9,7 +9,7 @@ TOD.colourscheme = {
I = "C", I = "C",
J = "B", J = "B",
L = "M", L = "M",
O = "F", O = "W",
S = "G", S = "G",
Z = "R", Z = "R",
T = "Y" T = "Y"