État du code du 12/03 Processing

PImage img;

boolean retourazeroordi= false;
int x = 180;
int y = 180;
int[] positionx;
int[] positiony;
int[] positionxbleu;
int[] positionybleu;
int[] positionxrouge;
int[] positionyrouge;
int numerotableauordi=15;
int numerotableau=1;
float temporisation =0;
boolean tir=false;
int lancer;
int lancerordi;
int coups=0;
boolean demarrage=false;
boolean demarrageordi=false;
boolean gagner=false;
void setup() {
positionx = new int [80];
positiony = new int [80];
positionxbleu = new int [4];
positionybleu = new int [4];
positionxrouge = new int [4];
positionyrouge = new int [4];
positions();
positionxbleu[0]=110;
positionybleu[0]=60;
positionxbleu[1]=110;
positionybleu[1]=100;
positionxbleu[2]=110;
positionybleu[2]=150;
positionxbleu[3]=110;
positionybleu[3]=175;
positionxrouge[0]=400;
positionyrouge[0]=60;
positionxrouge[1]=400;
positionyrouge[1]=100;
positionxrouge[2]=400;
positionyrouge[2]=150;
positionxrouge[3]=400;
positionyrouge[3]=175;img = loadImage("8961_plateau.jpg");
size(1100, 900);
}
void draw() {
noStroke();
background(#EFF70A);
tirer();
scale(1.750);
//rect(0, 0, 200, 200);
image(img, 0, 0);cercles();
joueurbleu();
joueurrouge();
gagner ();
//avancer();
}

void joueurbleu(){

for(int x=0; x<4; x++){
fill(#4B3ECB);
ellipse(positionxbleu[x],positionybleu[x],25,25);
}
}
void gagner (){
if(retourazeroordi){
if( numerotableauordi>14){
textSize(40);
text("L'ordinateur a gagné !!!!!",100,300);
gagner=true;}}
if (numerotableau>56){
textSize(40);
fill(#1B14FA);
text("Vous avez gagné !!!!!",100,300);
gagner=true;
}
}

void joueurrouge(){
for(int x=0; x<4; x++){
fill(#8E0002);
ellipse(positionxrouge[x],positionyrouge[x],25,25);
}
}

void tirer() {
fill(#51A4FA);
rect(950, 20, 120, 40);
fill(0);
textSize(32);
text("Tirer", 970, 50);
fill(#51A4FA);
rect(950, 80, 120, 40);
fill(0);
textSize(32);
if (lancer==0) {
text("", 970, 110);
}
else {
text(lancer, 970, 110);
}
fill(#51A4FA);
rect(950, 260, 120, 40);
fill(0);
textSize(32);
text("Vous", 970, 295);fill(#51A4FA);
rect(950, 140, 120, 40);
fill(0);
textSize(32);
text("Coups", 960, 170);
fill(#51A4FA);
rect(950, 200, 120, 40);
fill(0);
textSize(32);
text(coups, 970, 230);fill(#FA5651);
rect(950, 360, 120, 40);
fill(0);
textSize(32);
text("Tirage", 960, 390);
fill(#FA5651);
rect(950, 420, 120, 40);
fill(0);
text(lancerordi,970,450);
fill(0);
textSize(32);fill(#FA5651);
rect(950, 480, 120, 40);
fill(0);
textSize(32);
text("Coups", 960, 510);
fill(#FA5651);
rect(950, 540, 120, 40);
fill(0);
textSize(32);
text(coups, 970, 570);fill(#FA5651);
rect(950, 600, 120, 40);
fill(0);
textSize(32);
text("Ordi", 960, 630);if (tir) {
lancer = (int)random(1, 7);
lancerordi= (int)random(1, 7);
tir=false;
coups = coups+1;
avancer();
avancerordi();
}
if(gagner==false){
if (mousePressed) {
if (mouseX>950) {
if (mouseX<1070) {
if (mouseY<60) {
if (mouseY>20) {
if (millis()-temporisation>1000) {
tir=true;
temporisation=millis();
}
}
}
}
}
}
}}
void avancer() {
if (demarrage) {
//numerotableau = numerotableau+1;
numerotableau = numerotableau+lancer;
positionxbleu[0]=positionx[numerotableau];
positionybleu[0]=positiony[numerotableau];
}
if (lancer==6 && demarrage==false) {
positionxbleu[0] = positionx[numerotableau];
positionybleu[0]=positiony[numerotableau];
demarrage=true;
}
}
void avancerordi() {
if (demarrageordi) {
//numerotableau = numerotableau+1;numerotableauordi = numerotableauordi+lancerordi;
if (numerotableauordi>56){numerotableauordi=numerotableauordi-56;retourazeroordi=true;}
positionxrouge[0]=positionx[numerotableauordi];
positionyrouge[0]=positiony[numerotableauordi];
}
if (lancerordi==6 && demarrageordi==false) {
positionxrouge[0] = positionx[numerotableauordi];
positionyrouge[0]=positiony[numerotableauordi];
demarrageordi=true;
}

}

void positions(){
positionx[1]=28;
positiony[1]=225;
positionx[2]=61;
positiony[2]=225;
positionx[3]=94;
positiony[3]=225;
positionx[4]=127;
positiony[4]=225;
positionx[5]=160;
positiony[5]=225;
positionx[6]=193;
positiony[6]=225;
positionx[7]=225;
positiony[7]=226;
positionx[8]=225;
positiony[8]=193;
positionx[9]=225;
positiony[9]=160;
positionx[10]=225;
positiony[10]=127;
positionx[11]=225;
positiony[11]=94;
positionx[12]=225;
positiony[12]=60;
positionx[13]=225;
positiony[13]=29;
positionx[14]=258;
positiony[14]=26;
positionx[15]=292;
positiony[15]=28;
positionx[16]=292;
positiony[16]=61;
positionx[17]=292;
positiony[17]=94;
positionx[18]=292;
positiony[18]=127;
positionx[19]=292;
positiony[19]=160;
positionx[20]=292;
positiony[20]=193;
positionx[21]=292;
positiony[21]=225;
positionx[22]=326;
positiony[22]=225;
positionx[23]=359;
positiony[23]=225;
positionx[24]=392;
positiony[24]=225;
positionx[25]=425;
positiony[25]=225;
positionx[26]=458;
positiony[26]=225;
positionx[27]=491;
positiony[27]=225;
positionx[28]=491;
positiony[28]=257;
positionx[29]=491;
positiony[29]=292;
positionx[30]=458;
positiony[30]=292;
positionx[31]=425;
positiony[31]=292;
positionx[32]=392;
positiony[32]=292;
positionx[33]=359;
positiony[33]=292;
positionx[34]=326;
positiony[34]=292;
positionx[35]=294;
positiony[35]=292;
positionx[36]=294;
positiony[36]=325;
positionx[37]=294;
positiony[37]=358;
positionx[38]=294;
positiony[38]=391;
positionx[39]=294;
positiony[39]=422;
positionx[40]=294;
positiony[40]=455;
positionx[41]=294;
positiony[41]=488;
positionx[42]=261;
positiony[42]=488;
positionx[43]=225;
positiony[43]=490;
positionx[44]=225;
positiony[44]=457;
positionx[45]=225;
positiony[45]=425;
positionx[46]=225;
positiony[46]=393;
positionx[47]=225;
positiony[47]=361;
positionx[48]=225;
positiony[48]=327;
positionx[49]=225;
positiony[49]=295;
positionx[50]=194;
positiony[50]=292;
positionx[51]=160;
positiony[51]=292;
positionx[52]=127;
positiony[52]=292;
positionx[53]=94;
positiony[53]=292;
positionx[54]=61;
positiony[54]=292;
positionx[55]=28;
positiony[55]=292;
positionx[56]=28;
positiony[56]=261;}



void cercles(){
//ellipsebleu
fill(#56C4FA);
ellipse(28,225,30,30);
ellipse(61,225,30,30);
ellipse(94,225,30,30);
ellipse(127,225,30,30);
ellipse(160,225,30,30);
ellipse(193,225,30,30);
ellipse(225,226,30,30);
ellipse(225,193,30,30);
ellipse(225,160,30,30);
ellipse(225,127,30,30);
ellipse(225,94,30,30);
ellipse(225,61,30,30);
ellipse(225,29,30,30);
ellipse(258,26,30,30);//ellipserouge
fill(#FC2119);
ellipse(292,28,30,30);
ellipse(292,61,30,30);
ellipse(292,94,30,30);
ellipse(292,127,30,30);
ellipse(292,160,30,30);
ellipse(292,193,30,30);
ellipse(292,225,30,30);
ellipse(326,225,30,30);
ellipse(359,225,30,30);
ellipse(392,225,30,30);
ellipse(425,225,30,30);
ellipse(458,225,30,30);
ellipse(491,225,30,30);
ellipse(491,257,30,30);//ellipsejaune
fill(#F7FF15);
ellipse(491,292,30,30);
ellipse(458,292,30,30);
ellipse(425,292,30,30);
ellipse(392,292,30,30);
ellipse(359,292,30,30);
ellipse(326,292,30,30);
ellipse(294,292,30,30);
ellipse(294,325,30,30);
ellipse(294,358,30,30);
ellipse(294,391,30,30);
ellipse(294,422,30,30);
ellipse(294,455,30,30);
ellipse(294,488,30,30);
ellipse(261,488,30,30);
//ellipseverte
fill(#48FF5F);
ellipse(225,490,30,30);
ellipse(225,457,30,30);
ellipse(225,425.5,30,30);
ellipse(225,393,30,30);
ellipse(225,360,30,30);
ellipse(225,327,30,30);
ellipse(225,295,30,30);
ellipse(194,292,30,30);
ellipse(160,292,30,30);
ellipse(127,292,30,30);
ellipse(95,292,30,30);
ellipse(62,292,30,30);
ellipse(29,292,30,30);
ellipse(29,260,30,30);}

Les connaissances informatiques d'Ugo et Pauline. © 2017
Optimisé par Webnode
Créez votre site web gratuitement ! Ce site internet a été réalisé avec Webnode. Créez le votre gratuitement aujourd'hui ! Commencer