def start(): try: display.init() control.init() gameloop.start() finally: control.finish() display.exit() print("Game over! Score - ", Game.GameState().score)
def start(): CurrentGame = Game() CurrentGame.spawn_apple() while Game.GameState().state == 0: step(CurrentGame)
def finish(): Game.GameState().listener.stop()
def init(): Game.GameState().listener = keyboard.Listener(on_press=on_press) Game.GameState().listener.start()