ardoisemagique3.py

Created by jeromemunier

Created on March 07, 2021

1.54 KB


from math import *
from ion import *
from kandinsky import *

def aide():
  fill_rect(0,20,320,220,(255,255,255))
  draw_string("maintenir 4 pour le rouge",10,20)
  draw_string("maintenir 5 pour le vert",10,40)
  draw_string("maintenir 6 pour le bleu",10,60)
  draw_string("0 pour du blanc",10,80)
  draw_string("9 pour du noir",10,100)
  draw_string("+ augmente la taille",10,120)
  draw_string("- diminue la taille",10,140)
  draw_string("Flèches+EXE pour dessiner",10,160)
  draw_string("VAR pour couleur fond/effacer",10,180)
  draw_string("ANS pour cette aide",10,200)

x=50
y=50
r,v,b=255,255,255
draw_string("couleur ",2,2)
l=1
draw_string("taille",120,2)
draw_string(str(l),200,2)
aide()
while not keydown(KEY_OK):
  if keydown(KEY_VAR):
    fill_rect(0,20,320,220,couleur)
  
  if keydown(KEY_ANS):
    aide()
  
  
  if keydown(KEY_NINE):
    r,v,b=0,0,0
  if keydown(KEY_ZERO):
    r,v,b=255,255,255
  if keydown(KEY_FOUR):
    v,b=max([v-1,0]),max([b-1,0])
  if keydown(KEY_FIVE):
    r,b=max([r-1,0]),max([b-1,0])
  if keydown(KEY_SIX):
    v,r=max([v-1,0]),max([r-1,0])
  couleur=color(r,v,b)
  fill_rect(75,2,15,15,couleur)
  
  if keydown(KEY_PLUS):
    l=min([l+0.1,20])
  if keydown(KEY_MINUS):
    l=max([l-0.1,0])
  fill_rect(200,0,80,12,(255,255,255))
  draw_string(str(floor(l)),200,2)
  
  if keydown(KEY_DOWN):
    y=min([y+1,220])
  if keydown(KEY_UP):
    y=max([y-1,20])
  if keydown(KEY_RIGHT):
    x=min([x+1,320])
  if keydown(KEY_LEFT):
    x=max([x-1,0])
  
  if keydown(KEY_EXE):
    fill_rect(x,y,floor(l),floor(l),couleur)

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 cookies policy.