From df7dd1b1f35e566befd3031ce27ba6d67745a8f9 Mon Sep 17 00:00:00 2001 From: 0x81c Date: Mon, 16 Mar 2015 07:43:02 -0400 Subject: [PATCH] tidied up bump chec --- room.lua | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/room.lua b/room.lua index 90066ad..ae4d946 100644 --- a/room.lua +++ b/room.lua @@ -168,17 +168,15 @@ function Room:movePlayer(key) x = pos.x + dir.x, y = pos.y + dir.y } -- this is for reference for each color as we change the targetCells table - local initialTargetEntities = {} - - for _, color in pairs(self:getActiveColors()) do - initialTargetEntities[color] = self:getCellInMatrix(self.collidableMatrices[color], initialTargetCell) - if initialTargetEntities[color] then initialTargetEntities[color]:bump() print(bump) end - end + local initialTargetEntity + + initialTargetEntity = self:getCellInMatrix(self.collidableMatrices[color], initialTargetCell) + if initialTargetEntity then initialTargetEntity:bump() end if not self:isInBounds(initialTargetCell) then -- let's us move out of bounds to Change Rooms without pulling a bloc_ 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 move = true else