I finally got the coordinates to display on screen..and the turtle to jump to the proper location after the first correct answer..but it won't break out of the loop. I need it so I can type in the correct combination as after a player discovers the exact location
import turtle
from turtle import Turtle, Screen
import random
screen = Screen()
screen.bgpic('Housegame.gif')
screen.setup(width=800, height=600)
tur = Turtle()
tur = Turtle(shape="turtle")
tur.color("black")
tur.speed("fastest")
tur.color("black")
attempts = 0
right = 0
while True:
def get_mouse_click_coor(x, y):
print(x, y)
coords = input("Enter correct Letter code To continue")
dispcoords = ["c", "c"]
if coords == random.choice(dispcoords):
tur.goto(x=16, y=-132)
turtle.onscreenclick(get_mouse_click_coor)
turtle.mainloop()
tur.setposition(get_mouse_click_coor)
tur.penup()
p = tur.pos()
tur.write(str(p), True)
combo1 = input("Enter The Correct Combination to Enter")
combo1num = ["3442", "3442"]
if combo1 == random.choice(combo1num):
print("Access Granted")
attempts = attempts + 1
right = right + 1
print("Correct", right)
print("Attempts", attempts)
else:
print("Access Denied...Try Again")
attempts = attempts + 1
print("Attempts", attempts)
continue