Added Big Mode as a piece type. (#20)

Survival A3 and Phantom Mania 2 are now in their fully complete glory! :D

Implements #13.
This commit is contained in:
Joe Zeng
2019-06-16 22:16:09 -04:00
committed by GitHub
parent 5131061e42
commit 5c5ffc6887
14 changed files with 158 additions and 32 deletions

View File

@@ -2,7 +2,7 @@ local Object = require 'libs.classic'
local Piece = Object:extend()
function Piece:new(shape, rotation, position, block_offsets, gravity, lock_delay, skin)
function Piece:new(shape, rotation, position, block_offsets, gravity, lock_delay, skin, big)
self.shape = shape
self.rotation = rotation
self.position = position
@@ -12,6 +12,7 @@ function Piece:new(shape, rotation, position, block_offsets, gravity, lock_delay
self.skin = skin
self.ghost = false
self.locked = false
self.big = big
end
-- Functions that return a new piece to test in rotation systems.
@@ -20,7 +21,7 @@ function Piece:withOffset(offset)
return 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.block_offsets, self.gravity, self.lock_delay, self.skin, self.big
)
end
@@ -30,7 +31,7 @@ function Piece:withRelativeRotation(rot)
while new_rot >= 4 do new_rot = new_rot - 4 end
return Piece(
self.shape, new_rot, self.position,
self.block_offsets, self.gravity, self.lock_delay, self.skin
self.block_offsets, self.gravity, self.lock_delay, self.skin, self.big
)
end
@@ -145,7 +146,18 @@ function Piece:draw(opacity, brightness, grid, partial_das)
for index, offset in pairs(offsets) do
local x = self.position.x + offset.x
local y = self.position.y + offset.y
love.graphics.draw(blocks[self.skin][self.shape], 64+x*16+partial_das, 16+y*16+gravity_offset)
if self.big then
love.graphics.draw(
blocks[self.skin][self.shape],
64+x*32+partial_das*2, 16+y*32+gravity_offset*2,
0, 2, 2
)
else
love.graphics.draw(
blocks[self.skin][self.shape],
64+x*16+partial_das, 16+y*16+gravity_offset
)
end
end
return false
end