Initial 3D blocks support

This commit is contained in:
nightmareci
2022-07-04 21:05:40 -07:00
parent e5892c0fae
commit dcde2a380d
24 changed files with 6202 additions and 44 deletions

View File

@@ -5,6 +5,7 @@ local playedReadySE = false
local playedGoSE = false
local Grid = require 'tetris.components.grid'
local drawBlock = require 'tetris.components.draw_block'
local Randomizer = require 'tetris.randomizers.randomizer'
local BagRandomizer = require 'tetris.randomizers.bag'
local binser = require 'libs.binser'
@@ -787,13 +788,12 @@ function GameMode:drawLineClearAnimation()
for y, row in pairs(self.cleared_block_table) do
for x, block in pairs(row) do
local animation_table = self:animation(x, y, block.skin, block.colour)
love.graphics.setColor(
animation_table[1], animation_table[2],
animation_table[3], animation_table[4]
)
love.graphics.draw(
drawBlock(
animation_table[1], animation_table[2], animation_table[3], animation_table[4],
blocks[animation_table[5]][animation_table[6]],
animation_table[7], animation_table[8]
animation_table[7], animation_table[8],
48, 48+(self.grid.width+1)*16,
5*16, (self.grid.height+1)*16
)
end
end
@@ -820,7 +820,7 @@ function GameMode:drawGhostPiece(ruleset)
local ghost_piece = self.piece:withOffset({x=0, y=0})
ghost_piece.ghost = true
ghost_piece:dropToBottom(self.grid)
ghost_piece:draw(0.5)
ghost_piece:draw(0.5, 1, self.grid)
end
function GameMode:drawNextQueue(ruleset)
@@ -837,7 +837,11 @@ function GameMode:drawNextQueue(ruleset)
for index, offset in pairs(offsets) do
local x = offset.x + ruleset:getDrawOffset(piece, rotation).x + ruleset.spawn_positions[piece].x
local y = offset.y + ruleset:getDrawOffset(piece, rotation).y + 4.7
love.graphics.draw(blocks[skin][colourscheme[piece]], pos_x+x*16, pos_y+y*16)
drawBlock(
1, 1, 1, 1,
blocks[skin][colourscheme[piece]],
pos_x+x*16, pos_y+y*16
)
end
end
for i = 1, self.next_queue_length do