Beispiel #1
0
def StartRobotMotion():  #should only be called once
    try:
        os.chdir(folder_directory)
        execfile(
            RobotMotionName
        )  # the start file command doesn't work for this so had to use execfile
    except Exception as e:
        print(e)
settings = []
with open(
        "C:/Users/2005s/Documents/Visual Studio Code/Python/Tkinter/Custom-Text-Editor/Settings.txt",
        "r") as f:
    content = f.read()
    lines = content.splitlines()
    for line in lines:
        settings.append(line)

if settings[0] == "firstTimeOpeningApp=False":
    while tries != 0:
        password = input("\nWhat is the password? ")
        if password == "password":
            execfile(
                "C:/Users/2005s/Documents/Visual Studio Code/Python/Tkinter/Custom-Text-Editor/Custom Text Editor Interface Edition.py"
            )
        else:
            print("\nWrong password!")
            print(f"You have {tries - 1} tries left.")
            tries = tries - 1
else:
    while True:
        chosen_password = input(
            "\nWhat would you like the password for this application to be? Any characters are allowed. "
        )
        repeated_password = input(
            "\nPlease retype your password to confirm it. ")
        if chosen_password == repeated_password:
            False
        else:
    if keys[pygame.K_UP] and paddle_right_y > border_height:
        paddle_right_y -= paddle_speed
        print("Right paddle moved up")
    if keys[pygame.K_DOWN] and paddle_right_y < screen_height - paddle_height - border_height:
        paddle_right_y += paddle_speed
        print("Right paddle moved down")

    if keys[pygame.K_w] and paddle_left_y > border_height:
        paddle_left_y -= paddle_speed
        print("Left paddle moved up")
    if keys[pygame.K_s] and paddle_left_y < screen_height - paddle_height - border_height:
        paddle_left_y += paddle_speed
        print("Left paddle moved down")

    background_design_multiplayer_game()
    border_walls()
    multiplayer_paddles()
    display_scores_multiplayer()
    
    balls.update(ball_speed[0])
    balls.draw(multiplayer_game)

    pygame.display.update()

    if multiplayer_current_score[0] == 11 or multiplayer_current_score[1] == 11:
        # execfile(get_true_filename("Game_Over_Screen.py"))
        execfile("C:/Users/2005s/Documents/Visual Studio Code/Python/Pygame/Pong/Game_Over_Screen.py")

        sys.exit()

sys.exit()