def start(self): if self.isPaused: return self.isStarted = True self.tboard.score = 0 BOARD_DATA.clear() self.tboard.msg2Statusbar.emit(str(self.tboard.score)) BOARD_DATA.createNewPiece() self.timer.start(self.speed, self)
def start(self): if self.isPaused: return self.isStarted = True self.tboard.score = 0 BOARD_DATA.clear() self.tboard.msg2Statusbar.emit(str(self.tboard.score)) BOARD_DATA.createNewPiece() self.timer.start(self.speed, self)
def start(self): #시작 함수 if self.isPaused: return self.isStarted = True self.tboard.score = 0 BOARD_DATA.clear() #보드 데이터 초기화 self.tboard.msg2Statusbar.emit(str( self.tboard.score)) #스테이터스 바에 줄 파괴횟수 표기 BOARD_DATA.createNewPiece() self.timer.start(self.speed, self)
def keyPressEvent(self, event): if not self.isStarted or BOARD_DATA.currentShape == Shape.shapeNone: super(Tetris, self).keyPressEvent(event) return key = event.key() if key == Qt.Key_P: self.pause() return if self.isPaused: return elif key == Qt.Key_Left: BOARD_DATA.moveLeft() elif key == Qt.Key_Right: BOARD_DATA.moveRight() elif key == Qt.Key_Down: lineCheck = BOARD_DATA.moveDown() self.tboard.score += lineCheck if lineCheck >= 2: self.tboard.itemNum += int(lineCheck / 2) elif key == Qt.Key_Up: BOARD_DATA.rotateLeft() elif key == Qt.Key_Space: lineCheck = BOARD_DATA.dropDown() self.tboard.score += lineCheck if lineCheck >= 2: self.tboard.itemNum += int(lineCheck / 2) elif key == Qt.Key_Z: if self.tboard.itemNum >= 1: self.tboard.itemNum -= 1 itemRandom = random.randint(1, 2) if itemRandom == 1: BOARD_DATA.createNewPiece() elif itemRandom == 2: BOARD_DATA.clear() elif key == Qt.Key_Escape: self.reGame() else: super(Tetris, self).keyPressEvent(event) self.updateWindow()