def main_menu_chooser():
    """
        Let the player choose in the menu
    """

    # Print the menu
    print("\t\t\t1 - New Game")
    print("\t\t\t2 - Load Game")
    print("\t\t\t3 - Leaderboard")
    print("\t\t\t4 - Historic")
    print("\t\t\t5 - Quit\n")

    # Load the historic
    lb.load_historic()
    # Load the leaderboard
    lb.load_leaderboard()

    # Check the player choice
    player_choice = menu_choice("Main Menu")
    if player_choice == "1":
        # Start the game
        gdat.new_game()
    elif player_choice == "2":
        # Load a game if it exist
        gdat.load_game()
    elif player_choice == "3":
        # Show the leaderboard
        lb.leaderboard()
    elif player_choice == "4":
        # Show the historic
        lb.historic()
    else:
        # Quit the game
        sys.exit()
示例#2
0
def start_screen(first_game) -> None:
    sc.speed('fastest')
    sc.clear()
    leader_names, leader_scores = [], []
    lb.load_leaderboard(flappy.LB_FILE, leader_names, leader_scores)
    if not first_game:
        lb.update_leaderboard(flappy.LB_FILE, leader_names, leader_scores,
                              score.get_name(), score.get())
    lb.draw_leaderboard(leader_names, leader_scores, sc)
    font_setup = ("Arial", 20, "normal")
    sc.penup()
    sc.goto(-200, 200)
    sc.hideturtle()
    sc.down()
    sc.write("Press Space To Start", font=font_setup)
    sc.penup()
    sc.goto(-200, 150)
    sc.down()
    sc.write('Press "q" To Quit', font=font_setup)
    sc.penup()
    sc.goto(-200, 50)
    sc.down()
    sc.write('Leaderboard', font=font_setup)
    wn.onkeypress(launch_game, flappy.KEYS.get("SPACE"))
    wn.onkeypress(quit_game, flappy.KEYS.get("Q"))
    wn.listen()
    wn.mainloop()
def manage_leaderboard():
  global leader_scores_list
  global leader_names_list
  global score
  global t

  # load all the leaderboard records into the lists
  lb.load_leaderboard(leaderboard_file_name, leader_names_list, leader_scores_list)

  # TODO
  if (len(leader_scores_list) < 5 or score > leader_scores_list[4]):
    lb.update_leaderboard(leaderboard_file_name, leader_names_list, leader_scores_list, player_name, score)
    lb.draw_leaderboard(leader_names_list, leader_scores_list, True, t, score)

  else:
    lb.draw_leaderboard(leader_names_list, leader_scores_list, False, t, score)
示例#4
0
def manage_leaderboard():

  global leader_scores_list
  global leader_names_list
  global point
  global bucket

  # load all the leaderboard records into the lists
  lb.load_leaderboard(leaderboard_file_name, leader_names_list,leader_scores_list)

  # controls writing to the leaderboard
  if (len(leader_scores_list) < 5 or point > leader_scores_list[4]):
      lb.update_leaderboard(leaderboard_file_name,leader_names_list,leader_scores_list, player_name, point)
      lb.draw_leaderboard(leader_names_list, leader_scores_list, True, bucket,point)

  else:
      lb.draw_leaderboard(leader_names_list,leader_scores_list, False, bucket,point)
def manage_leaderboard():

    global leader_scores_list
    global leader_names_list
    global score
    global spot

    lb.load_leaderboard(leaderboard_file_name, leader_names_list,
                        leader_scores_list)

    if (len(leader_scores_list) < 5 or score > leader_scores_list[4]):
        lb.update_leaderboard(leaderboard_file_name, leader_names_list,
                              leader_scores_list, player_name, score)
        lb.draw_leaderboard(leader_names_list, leader_scores_list, True, spot,
                            score)
    else:
        lb.draw_leaderboard(leader_names_list, leader_scores_list, False, spot,
                            score)
示例#6
0
    global spot

    # TODO
    if (len(leader_scores_list) < 5 or score > leader_scores_list[4]):
        lb.update_leaderboard(leaderboard_file_name, leader_names_list,
                              leader_scores_list, player_name, score)
        lb.draw_leaderboard(leader_names_list, leader_scores_list, True, spot,
                            score)

    else:
        lb.draw_leaderboard(leader_names_list, leader_scores_list, False, spot,
                            score)


#-----initialize turtle-----
lb.load_leaderboard(leaderboard_file_name, leader_names_list,
                    leader_scores_list)
spot = tt.Turtle()
spot.color(turtle_color)
spot.shapesize(turtle_size)
spot.shape(turtle_shape)
spot.pu()
score_writer = tt.Turtle()
score_writer.pu()
score_writer.goto(190, 140)
score_writer.color("white")
score_writer.hideturtle()
counter = tt.Turtle()
counter.color("white")
counter.pu()
counter.goto(-190, 140)
counter.hideturtle()