Un système de pixel art. Les couleurs sont disponibles avec les touches “(“ “)” “*” “/” “+” “-“ Ans” “EXE” “shift” “alpha”
from math import * from kandinsky import * from ion import * def draw_map(): global x_map global y_map x_map=0 y_map=2 for i in range(704): fill_rect(x_map+1,y_map+1,8,8,couleurs[cp[i]]) x_map+=10 if x_map==320: y_map+=10 x_map=0 fill_rect(x_me+1,y_me+1,8,8,color(198,202,248)) #init x_map=0 y_map=2 x_me=0 y_me=2 cp=[] couleurs=["white","black","red","blue","green","yellow","purple","pink","gray","orange","brown"] for i in range(704): cp.append(0) fill_rect(0,0,320,222,"black") draw_map() while True: if keydown(KEY_UP): y_me-=10 draw_map() if keydown(KEY_DOWN): y_me+=10 draw_map() if keydown(KEY_LEFT): x_me-=10 draw_map() if keydown(KEY_RIGHT): x_me+=10 draw_map() if keydown(KEY_LEFTPARENTHESIS): cp[32*(int(y_me/10))+int(x_me/10)]=2 if keydown(KEY_RIGHTPARENTHESIS): cp[32*(int(y_me/10))+int(x_me/10)]=3 if keydown(KEY_MULTIPLICATION): cp[32*(int(y_me/10))+int(x_me/10)]=4 if keydown(KEY_DIVISION): cp[32*(int(y_me/10))+int(x_me/10)]=5 if keydown(KEY_PLUS): cp[32*(int(y_me/10))+int(x_me/10)]=6 if keydown(KEY_MINUS): cp[32*(int(y_me/10))+int(x_me/10)]=7 if keydown(KEY_ANS): cp[32*(int(y_me/10))+int(x_me/10)]=8 if keydown(KEY_EXE): cp[32*(int(y_me/10))+int(x_me/10)]=9 if keydown(KEY_ALPHA): cp[32*(int(y_me/10))+int(x_me/10)]=1 if keydown(KEY_SHIFT): cp[32*(int(y_me/10))+int(x_me/10)]=0