Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int tab1[]=new int[200];
- int tab[]=new int[200];
- int play; int turn; int time=1050-(turn*50); int color; int variablesuperlonguequiforcelerespect;int cas1=0;int cas2=0;int c=0; int variablesuperlonguequiforcelerespect2;
- boolean jouer=true;int faute=0;
- void main(){
- initialisation();
- bonhomme();
- turn=1;
- while(jouer=true){
- modele();
- }
- println("FIN");
- }
- void initialisation(){
- reset(50,50);
- int x=-50; int y=50; turn=0;
- green(); red(); yellow(); blue();
- while(x<51){
- setPixel(x,-20,237,213,0);//démarquation 1
- setPixel(x,-21,255,255,112);//démarquation 2
- setPixel(x,-22,237,213,0);//démarquation 3
- setPixel(x,-23,168,124,1);//démarquation 4
- x++;
- }
- x=-34;
- while(x<35){
- setPixel(x,15,0);//milieu horizontal
- setPixel(x,50,0);//haut
- setPixel(x,-20,0);//bas
- x++;
- }
- while(y>-21){
- setPixel(0,y,0);//milieu vertical
- setPixel(-35,y,0);//borne 1
- setPixel(35,y,0);//borne 2
- y--;
- }
- y=-50;
- while(y<-23){//remplissage menu bas gris
- x=-50;
- while(x<51){
- setPixel(x,y,240);
- x++;
- }
- y++;
- }
- }
- void bonhomme(){
- int x=-44;
- int y;
- while(x<-39){//ligne de 5 milieu
- setPixel(x,-26,255,255,0);//chapeau 2
- setPixel(x,-27,255,0,0);//chapeau rouge
- setPixel(x,-29,255,218,130);//visage 1
- setPixel(x,-30,255,218,130);//visage 2
- setPixel(x,-31,255,218,130);//visage 3
- setPixel(x,-41,0);//ceinture
- y=-33;
- while(y>-41){//corps
- setPixel(x,y,0,1,110);
- y--;
- }
- y=-44;
- while(y>-48){
- setPixel(x,y,74,74,255);
- y--;
- }
- x++;
- }
- x=-43;
- while(x<-40){//ligne de 3 milieu
- setPixel(x,-25,255,255,0);//chapeau 1
- setPixel(x,-42,74,74,255);//pant 1
- setPixel(x,-43,74,74,255);//pant 2
- setPixel(x,-33,255,255,0);//scarf 1
- setPixel(x,-34,255,255,0);//scarf 2
- setPixel(x,-30,0);//eye
- setPixel(x,-32,255,218,130);//visage 4
- x++;
- }
- x=-45;
- while(x<-38){//chapeau et chaussure ligne de 7
- setPixel(x,-28,255,255,0);
- setPixel(x,-48,94,50,0);
- x++;
- }
- setPixel(-42,-30,255,218,130);//eye
- setPixel(-42,-35,255,255,0);//scarf 3
- setPixel(-42,-37,255,0,0);//bouton 1
- setPixel(-42,-39,255,0,0);//bouton 2
- setPixel(-42,-41,255,255,255);
- setPixel(-39,-37,94,50,0);//panneau
- setPixel(-44,-42,156,205,255);//poche
- setPixel(-44,-43,156,205,255);//
- setPixel(-40,-42,156,205,255);//
- setPixel(-40,-43,156,205,255);//poche
- y=-44;
- while(y>-49){//entrejambe ligne droite milieu
- setPixel(-42,y,240);
- y--;
- }
- setPixel(-46,-33,0,1,110);//bras gauche début
- setPixel(-45,-33,0,1,110);//
- setPixel(-45,-34,0,1,110);//bras gauche début
- x=-47;
- while(x<-45){//bras gauche
- y=-34;
- while(y>-39){
- setPixel(x,y,0,1,110);
- y--;
- }
- x++;
- }
- setPixel(-46,-39,255,218,130);//main gauche
- setPixel(-47,-39,255,218,130);//
- setPixel(-46,-40,255,218,130);//
- setPixel(-47,-40,255,218,130);//main gauche
- y=-37;
- while(y>-40){
- setPixel(-38,y,0,1,110);
- setPixel(-37,y,0,1,110);
- y--;
- }
- x=-40;
- while(x<-37){//main droite
- y=-38;
- while(y>-41){
- setPixel(x,y,255,218,130);
- y--;
- }
- x++;
- }
- x=-41;
- while(x<-36){
- y=-32;
- while(y>-37){
- setPixel(x,y,255);//COULEUR PANNEAU
- y--;
- }
- x++;
- }
- }
- void green(){//remplissage classique vert
- int z=-22; int x2=-12;int y=28; int y2=38; int x;
- if(turn==0){
- z=-34;x2=0;y=16;y2=50;
- }
- while(y<y2){
- x=z;
- while(x<x2){
- setPixel(x,y,150,255,150);
- x++;
- }
- y++;
- }
- }
- void red(){//remplissage classique rouge
- int z=13; int x2=23;int y=28;int y2=38; int x;
- if(turn==0){
- z=1;x2=35;y=16;y2=50;
- }
- while(y<y2){
- x=z;
- while(x<x2){
- setPixel(x,y,255,150,150);
- x++;
- }
- y++;
- }
- }
- void yellow(){//remplissage classique jaune
- int x; int z=-22; int x2=-12; int y=-7; int y2=3;
- if(turn==0){
- z=-34;x2=0;y=-19;y2=15;
- }
- while(y<y2){
- x=z;
- while(x<x2){
- setPixel(x,y,255,255,150);
- x++;
- }
- y++;
- }
- }
- void blue(){//remplissage classique bleu
- int x; int z=13; int x2=23; int y=-7; int y2=3;
- if(turn==0){
- z=1;x2=35;y=-19;y2=15;
- }
- while(y<y2){
- x=z;
- while(x<x2){
- setPixel(x,y,150,150,255);
- x++;
- }
- y++;
- }
- }
- void light(){
- int x; int y; int z; int x2; int y2; int R; int V; int B;
- if(color==0){//greenlight
- z=-22; y=28; R=0; V=255; B=0;
- }
- else if(color==1){//redlight
- z=13; y=28; R=255; V=0; B=0;
- }
- else if(color==2){//yellowlight
- z=-22; y=-7; R=255; V=255; B=0;
- }
- else{//bluelight
- z=13; y=-7; R=0; V=0; B=255;
- }
- x2=z+10; y2=y+10;
- while(y<y2){
- x=z;
- while(x<x2){
- setPixel(x,y,R,V,B);
- x++;
- }
- y++;
- }
- sleep(time);
- if(color==0){
- green();
- }
- else if(color==1){
- red();
- }
- else if(color==2){
- yellow();
- }
- else{
- blue();
- }
- }
- void modele(){
- variablesuperlonguequiforcelerespect=turn+3;
- variablesuperlonguequiforcelerespect2=variablesuperlonguequiforcelerespect;
- while(variablesuperlonguequiforcelerespect>0){
- color=random(0,4);
- tab[cas1]=color+1;
- cas1++;
- light();
- variablesuperlonguequiforcelerespect--;
- }
- while(variablesuperlonguequiforcelerespect2>0){
- while(c==0){
- setRunnable(new Runnable() { public void run() {
- int a=getX();
- int z=getY();
- if (((-1)>a && a>(-34))&&(16<z && z<46)){
- c=1;
- println("vert");
- }
- else if ((1<a && a<34)&&(16<z && z<46)){
- c=2;
- println("rouge");
- }
- else if (((-1)>a && a>(-34))&&(14>z && z>(-19))){
- c=3;
- println("Jaune");
- }
- else if ((1<a && a<34)&&(14>z && z>(-19))){
- c=4;
- println("Bleu");
- }
- else{
- c=0;
- println("Clickez sur les cases et évitez les bordures svp.");
- }
- }});
- }
- tab1[cas2]=c;
- if (tab1[cas2]!=tab[cas2]){
- faute++;
- println("réessaie bb");
- if (faute==3){
- jouer=false;
- }
- else{
- cas2++;
- variablesuperlonguequiforcelerespect2--;
- println("bon");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement