window.blit(transform.scale(BACKGROUND, SCREEN_SIZE), (0, 0)) labyrinth = Map(FILE) labyrinth.generate() labyrinth.display(window) display.flip() Macgyver = Player(labyrinth) display.flip() while GAME_LOOP: time.Clock().tick(30) for e in event.get(): if e.type == QUIT: MAIN_LOOP = False GAME_LOOP = False if e.type == KEYDOWN: if e.key == K_RIGHT: Macgyver.move('right') if e.key == K_LEFT: Macgyver.move('left') if e.key == K_UP: Macgyver.move('up') if e.key == K_DOWN: Macgyver.move('bottom') if labyrinth.grid[Macgyver.sprite_y][ Macgyver.sprite_x] == 'G': if Macgyver.counter == labyrinth.position: window.blit( transform.scale(WIN, SCREEN_SIZE), (0, 0)) FONT = font.Font(None, 50) TEXT_WIN = FONT.render( "Proud of you", True, (200, 200, 200))
def update(p: Player, textOutput: bool): if textOutput: print("[Python]", p.getX()) p.move(1, 0) if textOutput: print("[Python]", p.getX())