title: How to manage the conditions of the increase of a score?
body: <p>I have a problem with the program of my game Flappy Bird. I managed to increase a score on the screen. However, it increases every time the pipes come out of the screen, which is not what I want ...</p>
  
  <p>Indeed, I would like the score to increase each time the bird passes between the pipes and so each time that tuyx and tuyx2 are equal to 67 but when I change the conditions, the score stays at 0.</p>
  
  <p>Would anyone have the solution to my problem?
  Here is the program and the pictures of my game ;)</p>
  
  <p><a href="http://www.mediafire.com/file/nr1a1qmfsh6s8s4/Flappy+Bird.zip" rel="nofollow noreferrer">Here are the pictures</a></p>
  
  <pre><code>from tkinter import *
  import random
  from random import randint
  
  def sauter(event):
      canvas.move(image_oiseau, 0, -10*DY)
  
  
  def deplacement():
      global tuyx,tuyx2,h,H,oisx,oisy,solx,sol2x,score
  
      x0, y0, x1, y1 = canvas.bbox(image_oiseau)
      if y1 &lt; 416:
          canvas.move(image_oiseau, 0, DY)
  
      canvas.coords(image_sol,solx,512)  
      if solx &gt;= -144:
          solx=solx-5
      else:
          solx=144
  
      canvas.coords(image_sol2,sol2x,512)
      if sol2x &gt;= 144:
          sol2x=sol2x-5
      else:
          sol2x=432
  
      canvas.coords(image_tuyau_haut,tuyx,h)
      canvas.coords(image_tuyau_bas,tuyx,h-241)
      if tuyx&gt;=-28:
          tuyx=tuyx-5
      else:
          tuyx=316
          h=randint(256,505)
          score+=1
  
      canvas.coords(image_tuyau_haut2,tuyx2,H)
      canvas.coords(image_tuyau_bas2,tuyx2,H-241)
      if tuyx2&gt;=-28:
          tuyx2=tuyx2-5
      else:
          tuyx2=316
          H=randint(256,505)
          score+=1
  
      lscore.config(text=str(score))    
      canvas.after(40,deplacement)  
  
  LARGEUR = 286
  HAUTEUR = 510
  DY = 5
  tuyx=316
  tuyx2=488 
  h=randint(256,505)
  H=randint(256,505)
  oisx=67
  oisy=244
  solx=144
  sol2x=432
  score=0
  
  
  fenetre = Tk()
  canvas = Canvas(fenetre, width=LARGEUR, height=HAUTEUR)
  
  fond = PhotoImage(file="background-day.png")
  fond2 = PhotoImage(file="background-night.png")
  fond=[fond,fond2]
  F= random.choice(fond)
  canvas.create_image(144,256, anchor=CENTER,image=F)
  
  tuyau_haut = PhotoImage(file="tuyau_vers_le_haut.png")
  image_tuyau_haut = canvas.create_image(tuyx,h,anchor=CENTER,image=tuyau_haut)
  image_tuyau_haut2 = canvas.create_image(tuyx2,H,anchor=CENTER,image=tuyau_haut)
  
  tuyau_bas = PhotoImage(file="tuyau_vers_le_bas.png")
  image_tuyau_bas = canvas.create_image(tuyx,h,anchor=CENTER,image=tuyau_bas)
  image_tuyau_bas2 = canvas.create_image(tuyx2,H,anchor=CENTER,image=tuyau_bas)
  
  sol = PhotoImage(file="sol-day.png")
  image_sol = canvas.create_image(144,512, anchor=S,image=sol)
  image_sol2 = canvas.create_image(432,512, anchor=S,image=sol)
  
  oiseau = PhotoImage(file="yellowbird-midflap.png")
  oiseau2 = PhotoImage(file="bluebird-midflap.png")
  oiseau3 = PhotoImage(file="redbird-midflap.png")
  oiseau=[oiseau,oiseau2,oiseau3]
  O=random.choice(oiseau)
  image_oiseau=canvas.create_image(oisx,oisy, anchor=W,image=O) 
  
  lscore=Label(fenetre,text='0')
  lscore.pack()
  
  deplacement()
  
  canvas.pack()
  canvas.focus_set()
  canvas.bind("&lt;space&gt;",sauter) 
  
  fenetre.mainloop() 
  </code></pre>