Ejemplo n.º 1
0
 def hitCeil(self, rect):
     logicLocationTL = getLogicLocation(rect.topleft)
     logicLocationTR = getLogicLocation((rect.right - 1, rect.top))
     return rect.top <= 0 or \
            (self.gameMap.covered(logicLocationTL)) or \
            (self.gameMap.covered(logicLocationTR)) or \
            (self.gameMap.getCellColor(logicLocationTL) != self.bgColor) or \
            (self.gameMap.getCellColor(logicLocationTR) != self.bgColor)
Ejemplo n.º 2
0
 def hitFloor(self, rect):
     logicLocationBL = getLogicLocation(rect.bottomleft)
     logicLocationBR = getLogicLocation((rect.right - 1, rect.bottom))
     return rect.bottom >= GAME_SCREEN_HEIGHT or \
            (self.gameMap.covered(logicLocationBL)) or \
            (self.gameMap.covered(logicLocationBR)) or \
            (self.gameMap.getCellColor(logicLocationBL) != self.bgColor) or \
            (self.gameMap.getCellColor(logicLocationBR) != self.bgColor)
Ejemplo n.º 3
0
 def hitRight(self, rect):
     logicLocationTR = getLogicLocation(rect.topright)
     logicLocationBR = getLogicLocation(
         (rect.bottomright[0], rect.bottomright[1] - 1))
     return rect.right >= GAME_SCREEN_WIDTH or \
            (self.gameMap.covered(logicLocationTR)) or \
            (self.gameMap.covered(logicLocationBR)) or \
            (self.gameMap.getCellColor(logicLocationTR) != self.bgColor) or \
            (self.gameMap.getCellColor(logicLocationBR) != self.bgColor)
Ejemplo n.º 4
0
 def hitLeft(self, rect):
     logicLocationTL = getLogicLocation(rect.topleft)
     logicLocationBL = getLogicLocation(
         (rect.bottomleft[0], rect.bottomleft[1] - 1))
     return rect.left <= 0 or \
            (self.gameMap.covered(logicLocationTL)) or \
            (self.gameMap.covered(logicLocationBL)) or \
            (self.gameMap.getCellColor(logicLocationTL) != self.bgColor) or \
            (self.gameMap.getCellColor(logicLocationBL) != self.bgColor)
Ejemplo n.º 5
0
 def canShift(self):
     logicLocationBL = getLogicLocation(self.rect.bottomleft)
     logicLocationBR = getLogicLocation(
         (self.rect.right - 1, self.rect.bottom))
     return logicLocationBL[1] < GAME_SCREEN_HEIGHT // CELL_SIZE and \
            (not self.gameMap.covered(logicLocationBL)) and \
            (not self.gameMap.covered(logicLocationBR)) and \
            self.gameMap.getCellColor(logicLocationBL) != self.bgColor and \
            self.gameMap.getCellColor(logicLocationBR) != self.bgColor