def pointEat(self): # 포인트를 먹는 함수 if gamegrid[self.i] not in (1, 2): return # 팩맨이 위치한 곳에 포인트가 없다면 실행 X elif gamegrid[self.i] == 1: writeScore(10) self.last_eat_time = self.timer # 마지막으로 먹은 시간 갱신 gamegrid[self.i] = 0 # gamegrid(맵구조) 에서 먹힌 포인트는 0으로 pgf.killSprite(point_d[self.i].sprite) # 자리에있던 포인트 스프라이트 제거. del point_d[self.i]
def eatDot(self): global grid i = xy2i(self.x, self.y) if grid[i] in (1, 2): if grid[i] == 2: changeGhostMode('flucht') grid[i] = 0 pgf.killSprite(dots[i].sprite) del dots[i] if not dots: changeGameStatus('nextLevel') timer2 = threading.Timer(1.2, nextPacman) timer2.start() grid = grid_save.copy() dotsAufbauen()
def restart(): global snakeman global SCORE global NEXT_ANIMATION global TICK_RATE global punkt global spielraster global restartCounter #kill sprites pgf.killSprite(snakeman.sprite) for body in snakeman.body: pgf.killSprite(body.sprite) pgf.killSprite(punkt.sprite) #setup start parameter spielraster = SPIELRASTER_START.copy() snakeman = Snakeman("Snake-Man", (SNAKEMAN_START_X, SNAKEMAN_START_Y)) NEXT_ANIMATION = pgf.clock() + ANIMATION_REFRESH_RATE SCORE = -100 TICK_RATE = START_RATE - ADD_TICK_RATE restartCounter = 0 snakeman.addBody() snakeman.addBody() punkt = None
def punktFressen(self, punkt): if spielraster[self.i] != 1: return punkt pgf.killSprite(punkt.sprite) spielraster[self.i] = 0 self.addBody() return None
def pointEat(self): if gamegrid[self.i] not in (1, 2): return gamegrid[self.i] = 0 pgf.killSprite(point_d[self.i].sprite) writeScore(10) del point_d[self.i]
def nueva_imagen(self, file): killSprite(self.sprite) self.nombeArchivo = file self.sprite = makeSprite(PATHS.PATH_IMAGENES + self.nombeArchivo)