in the global frame, I set timetest = True, but when i run this function is says that timetest was referenced before assignment.
def hover(leftmost,rightmost,downmost,upmost,characterpicked):
if event.type == pygame.MOUSEMOTION:
if event.pos[0] > leftmost and event.pos[0] < rightmost:
if event.pos[1] > downmost and event.pos[1] < upmost:
#not complete
if timetest == True:
#original time touched name
timetestorg = pygame.time.get_ticks()
timetest = False
print(timetestorg)
print(pygame.time.get_ticks())
#checks a few seconds after
if (pygame.time.get_ticks() > timetestorg + 700 and pygame.time.get_ticks() < timetestorg + 800):
#check location still good
if event.pos[0] > leftmost and event.pos[0] < rightmost:
if event.pos[1] > downmost and event.pos[1] < upmost:
#create person object called ness
name = "player" + str(playernum)
playernum += 1
name = Person(characterpicked)
#put selected on screen
creation = True
chosen = myfont.render("Selected", 1, (0,0,0))
#make sure to check if you changed choseness to chosen
timetest = True
line 39, in hover if timetest == True: UnboundLocalError: local variable 'timetest' referenced before assignment