osu.py

Created by kbdechez-lidl

Created on January 27, 2023

1.73 KB


from math import *
from kandinsky import *
from ion import *
from random import *
from time import *

def clear():
  h=0
  for i in range(25):
    draw_string("                                      ",0,h)
    h=h+15

def menu():
  max=50
  nbmenu=1
  draw_string("[OK] pour commecer",70,50)
  while True:
    draw_string(str(max),200,100)
    if keydown(KEY_OK)==True:
      print(clear())
      print(jeu(max))
      sleep(0.1)
    if keydown(KEY_PLUS)==True:
      draw_string("   ",200,100)
      sleep(0.1)
      nbmenu=nbmenu-1
    if keydown(KEY_PLUS)==True:
      draw_string("   ",200,100)
      sleep(0.1)
      nbmenu=nbmenu+1
    if nbmenu==0:
      max=20
    if nbmenu==1:
      max=50
    if nbmenu==2:
      max=70
    if nbmenu==3:
      max=100
    if nbmenu<0:
      nbmenu=3
    if nbmenu>3:
      nbmenu=0
      
    
def jeu(max):
  compte=0
  while True:
    draw_string(str(compte)+"/"+str(max),140,0)
    r=randint(1,4)
    if r==1:
      draw_string("HAUT",140,80)
      while True:
        if keydown(KEY_UP)==True:
          compte=compte+1
          draw_string("    ",140,80)
          break
    elif r==2:
      draw_string("DROITE",170,100)
      while True:
        if keydown(KEY_RIGHT)==True:
          compte=compte+1
          draw_string("      ",170,100)
          break
    elif r==3:
      draw_string("BAS",140,120)
      while True:
        if keydown(KEY_DOWN)==True:
          compte=compte+1
          draw_string("   ",140,120)
          break
    elif r==4:
      draw_string("GAUCHE",100,100)
      while True:
        if keydown(KEY_LEFT)==True:
          compte=compte+1
          draw_string("      ",100,100)
          break
    if compte==max+1:
      print(menu())        
            
    
print(menu())

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.