From 351fb4cfe9b15018192c7a1a9801d950151ced4c Mon Sep 17 00:00:00 2001 From: Ishaan Bhardwaj Date: Wed, 18 Nov 2020 12:17:04 -0500 Subject: [PATCH] Added the functionality to draw only an outline of the stack --- tetris/components/grid.lua | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/tetris/components/grid.lua b/tetris/components/grid.lua index 347dbf5..c921e83 100644 --- a/tetris/components/grid.lua +++ b/tetris/components/grid.lua @@ -319,6 +319,29 @@ function Grid:draw() end end +function Grid:drawOutline() + for y = 5, 24 do + for x = 1, 10 do + if self.grid[y][x] ~= empty then + love.graphics.setColor(0.8, 0.8, 0.8, 1) + love.graphics.setLineWidth(1) + if y > 1 and self.grid[y-1][x] == empty then + love.graphics.line(48.0+x*16, -0.5+y*16, 64.0+x*16, -0.5+y*16) + end + if y < 24 and self.grid[y+1][x] == empty then + love.graphics.line(48.0+x*16, 16.5+y*16, 64.0+x*16, 16.5+y*16) + end + if x > 1 and self.grid[y][x-1] == empty then + love.graphics.line(47.5+x*16, -0.0+y*16, 47.5+x*16, 16.0+y*16) + end + if x < 10 and self.grid[y][x+1] == empty then + love.graphics.line(64.5+x*16, -0.0+y*16, 64.5+x*16, 16.0+y*16) + end + end + end + end +end + function Grid:drawInvisible(opacity_function, garbage_opacity_function, lock_flash, brightness) lock_flash = lock_flash == nil and true or lock_flash brightness = brightness == nil and 0.5 or brightness