def redraw_board(): gameloop.init() theme.update() # This is going to create the new theme if it doesn't exist # Force the game to update graphics.drawGame() graphics.update()
def update(): key = graphics.screen.getch() if key > 0: if key == keys['DOWN']: if game.direction[1] == -1: return game.direction = (0, 1) elif key == keys['LEFT']: if game.direction[0] == 1: return game.direction = (-1, 0) elif key == keys['RIGHT']: if game.direction[0] == -1: return game.direction = (1, 0) elif key == keys['UP']: if game.direction[1] == 1: return game.direction = (0, -1) elif key == keys['Q']: __main__.exit() exit() elif gameloop.state == 1 and key == keys['ENTER']: gameloop.init()
def update(): global set key = graphics.screen.getch() if key > 0 and not set: if key == keys['DOWN']: if game.direction[1] == -1: return set = True game.direction = (0, 1) elif key == keys['LEFT']: if game.direction[0] == 1: return set = True game.direction = (-1, 0) elif key == keys['RIGHT']: if game.direction[0] == -1: return set = True game.direction = (1, 0) elif key == keys['UP']: if game.direction[1] == 1: return set = True game.direction = (0, -1) if key > 0: if key == keys['q'] or key == keys['Q']: __main__.exit() elif gameloop.state == 2 and key == keys['ENTER']: if parser.args.tutorial: __main__.exit() else: gameloop.init() elif gameloop.state == 0 and key == keys['ENTER']: gameloop.init()
def redraw_board(): gameloop.init() theme.update() # This is going to create the new theme if it doesnt exist