Crash not detected

I am coding a game in python which involves detection when two sprites hit each other but this is not working. Please can someone give me some advice?

<p>from tkinter import *
import random
from random import randint
import time
from time import *

root = Tk()
root.title('Circle Vs Squares')

c = Canvas(root, height=500, width=500, bg='lightgreen')
score = 0

game_over = c.create_text(250, 250, text='GAME OVER', fill='black', state=HIDDEN)

play = c.create_polygon(-250, 250, 250, 0, -250, -250, fill='red', state=NORMAL)
play_text = c.create_text(250, 250, text='Click to play:', fill='black', state=NORMAL )
title = c.create_text(250, 225, text='Circle Vs Squares')
c.move(play, 250, 250)
c.pack()
game_started = False
free = True
score_text = c.create_text(50, 50, text='Score:  '+ str(score), fill='red', state=HIDDEN)
def start_game(event):
                game_started = True
                c.itemconfig(title, state=HIDDEN)
                c.itemconfig(play_text, state=HIDDEN)     
                c.itemconfig(play, state=HIDDEN)
                c.itemconfig(player, state=NORMAL)
                c.itemconfig(square1, state=NORMAL)
                c.itemconfig(score_text, state=NORMAL)
c.bind('<Button-1>', start_game)



def score():
                while game_started == True and free == True:
                                global score
                                time.sleep(1)
                                score = score + 1
                                c.itemconfig(score_text, text='Score:  '+ str(score))
                return score
                score.update()

player_r = 15
player = c.create_oval(250, 50, 300, 100, fill='blue', state=HIDDEN)                
c.pack()
player_spd = 10
game_started = True

square_spd = 5

square1 = c.create_rectangle(250, 400, 300, 450, fill='blue', state=HIDDEN)
square_r = 20
square_spd = 5  

def crash():
                while free == True:

                                if distance(player, square1) < (20):
                                  c.itemconfig(game_over, state=NORMAL)
                                  c.itemconfig(player, state=HIDDEN)
                                  c.itemconfig(square1, state=HIDDEN)
                                  free = False

def move_square():
                while free == True:
                                 c.move(square1, square_spd, randint(0, 359))
                
if game_started == True:
                def move_player(event):
                                if event.keysym == 'Up':
                                                c.move(player, 0, -player_spd)
                                elif event.keysym == 'Down':
                                                c.move(player, 0, player_spd)
                                elif event.keysym == 'Left':
                                                c.move(player, -player_spd, 0)
                                elif event.keysym == 'Right':
                                                c.move(player, player_spd, 0)
                c.bind_all('<Key>', move_player)

#MAIN GAME LOOP

while free == True and game_started == True:
                move_player()
                move_square()
                score()
                crash()
                root.update()</p>

Help would be much appriciated.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

Please use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks are not single quotes.

markdown_Forums