tidied up bump chec

This commit is contained in:
0x81c 2015-03-16 07:43:02 -04:00
parent 1c1ec291a7
commit df7dd1b1f3

View file

@ -168,17 +168,15 @@ function Room:movePlayer(key)
x = pos.x + dir.x, y = pos.y + dir.y x = pos.x + dir.x, y = pos.y + dir.y
} -- this is for reference for each color as we change the targetCells table } -- this is for reference for each color as we change the targetCells table
local initialTargetEntities = {} local initialTargetEntity
for _, color in pairs(self:getActiveColors()) do initialTargetEntity = self:getCellInMatrix(self.collidableMatrices[color], initialTargetCell)
initialTargetEntities[color] = self:getCellInMatrix(self.collidableMatrices[color], initialTargetCell) if initialTargetEntity then initialTargetEntity:bump() end
if initialTargetEntities[color] then initialTargetEntities[color]:bump() print(bump) end
end
if not self:isInBounds(initialTargetCell) then if not self:isInBounds(initialTargetCell) then
-- let's us move out of bounds to Change Rooms without pulling a bloc_ -- let's us move out of bounds to Change Rooms without pulling a bloc_
move = true move = true
elseif initialTargetEntities["red"] and initialTargetEntities["red"]:canPassOver() then elseif initialTargetEntity and initialTargetEntity:canPassOver() then
--we should put this in the else statement actually --we should put this in the else statement actually
move = true move = true
else else