Fixed a sound effect handle with negative gravity

This commit is contained in:
Ishaan Bhardwaj 2021-02-21 10:08:58 -05:00
parent eae58f11e9
commit 9129503d54

View File

@ -130,8 +130,6 @@ function Piece:addGravity(gravity, grid, classic_lock)
self:isMoveBlocked(grid, { x=0, y=-1 }) and gravity < 0 self:isMoveBlocked(grid, { x=0, y=-1 }) and gravity < 0
) then ) then
local dropped_squares = math.floor(math.abs(new_gravity)) local dropped_squares = math.floor(math.abs(new_gravity))
local new_frac_gravity = new_gravity - dropped_squares
self.gravity = new_frac_gravity
if gravity >= 0 then if gravity >= 0 then
local new_frac_gravity = new_gravity - dropped_squares local new_frac_gravity = new_gravity - dropped_squares
self.gravity = new_frac_gravity self.gravity = new_frac_gravity
@ -143,6 +141,9 @@ function Piece:addGravity(gravity, grid, classic_lock)
local new_frac_gravity = new_gravity + dropped_squares local new_frac_gravity = new_gravity + dropped_squares
self.gravity = new_frac_gravity self.gravity = new_frac_gravity
self:moveInGrid({ x=0, y=-1 }, dropped_squares, grid) self:moveInGrid({ x=0, y=-1 }, dropped_squares, grid)
if self:isMoveBlocked(grid, { x=0, y=-1 }) then
playSE("bottom")
end
end end
else else
self.gravity = 0 self.gravity = 0