-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcode source.txt
2268 lines (1907 loc) · 62.9 KB
/
code source.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//---------------------------------------------------------------------------------
// Déclaration de variables globales
//---------------------------------------------------------------------------------
boolean suivant=false;
//---------------------------------------------------------------------------------
// acceuil
//---------------------------------------------------------------------------------
PImage fondecran;
boolean fin=false;
//---------------------------------------------------------------------------------
// menu
//---------------------------------------------------------------------------------
//---------------------------------------------------------------------------------
// niveaux
//---------------------------------------------------------------------------------
int numJeu=0;
int diametreCercle=100;
PImage ferme, enclos,fondecran_niveaux,fondecran_niv;
int decallage;
int []xetoile={1094/10, 1100/10, 1103/10, 1108/10};//coordonée x de chaque images etoiles
int []yetoile={428/10, 428/10, 431/10, 428/10};//coordonée y de chaque images etoiles
//moi
/*int []x_cercle_niveaux = {150,200,330,490,580,700,850,1020,1150,1230};//coordonée x de chaque centre des cercles rouges
int []y_cercle_niveaux = {330,490,600,530,360,220,130,200,340,510};//coordonée y de chaque centre des cercles rouges
int []diametre_cercle_niveaux={100,100,100,100,100,100,100,100,100,100};//diametre de chaque cercle*/
//justine
int []x_cercle_niveaux = {962,664,400,200,275,410,525,615,685,750};//coordonée x de chaque centre des cercles rouges
//int []y_cercle_niveaux = {645,651,614,526,398,325,315,305,294,285};//coordonée y de chaque centre des cercles rouges
int []y_cercle_niveaux = {600,620,610,520,350,330,315,310,300,295};//coordonée y de chaque centre des cercles rouges
int []rayon_cercle_niveaux={278,270,241,206,160,132,118,95,87,80};//diametre de chaque cercle
int []score_general=new int[10];//tous les scores sont rentréss dans ce tableau
PImage etoile_niveaux;
int score1=0;
int score2=0;
int score3=0;
int score4=0;
int score5=0;
int score6=0;
int score7=0;
int score8=0;
int score9=0;
int score10=0;
//---------------------------------------------------------------------------------
// jeu1
//---------------------------------------------------------------------------------
Loup loup1 = new Loup(1000, 100, "right");
Loup loup2 = new Loup(900, 500, "down");
Loup loup3 = new Loup(700, 100, "left");
Loup loup4 = new Loup(200, 400, "up");
Loup loup5 = new Loup(900, 400, "right");
Loup loup6 = new Loup(800, 100, "down");
Loup loup7 = new Loup(1300, 600, "left");
Loup loup8 = new Loup(200, 300, "right");
Loup loup9 = new Loup(100, 100, "down");
Sheep sheep = new Sheep(1350, 750);
int moveX_1 = 2;
int moveY_1 = 0;
int moveX_2 = 0;
int moveY_2 = 1;
int moveX_3 = -2;
int moveY_3 = 0;
int moveX_4 = 0;
int moveY_4 = -1;
int moveX_5 = 1;
int moveY_5 = 0;
int moveX_6 = 0;
int moveY_6 = 1;
int moveX_7 = -1;
int moveY_7 = 0;
int moveX_8 = 1;
int moveY_8 = 0;
int moveX_9 = 0;
int moveY_9 = 1;
int scoreFinal, scoreFinalFinal;
//---------------------------------------------------------------------------------
// jeu2
//---------------------------------------------------------------------------------
PImage mirroir;
int x2=345;
int y2=770;
int z2=1045;
int a2=770;
color mur1, mur3, mur4;
color mur2, mur5, mur6, mur7, mur8;
float compteur=0;
boolean test=false;
int pixelmurs=-4621737;
//---------------------------------------------------------------------------------
// jeu3
//---------------------------------------------------------------------------------
PImage mouton1;
PImage mouton2;
PImage mouton3;
PImage etoile_vide;
PImage etoile;
int x_3=100, x1_3=-800;
float vitesse_3=0;
float posmouton_3=1410;
float posmouton2_3=2000;
int score_3=0;
int duree_3=0;
int temps_3=0;
boolean a_3=true;
//---------------------------------------------------------------------------------
// jeu4
//---------------------------------------------------------------------------------
PImage maze;
int x4 = 700;//position initiale en x
int y4 = 758; // position initiale en y
int vie = 3;
boolean up = false;
boolean down = false;
boolean right = false;
boolean left = false;
color c;
PImage troll;
//---------------------------------------------------------------------------------
// jeu5
//---------------------------------------------------------------------------------
PImage fondecran_5;
boolean test_5=false;
//chemin1
PImage grotte1;
boolean test1_5=false;
int a_5,b_5,c_5=0;
//chemin2
boolean test2_5=false;
//chemin3
boolean test3_5=false;
//end
//PImage etoile;
//---------------------------------------------------------------------------------
// jeu6
//---------------------------------------------------------------------------------
float a_6;
double PlayerPos = 360;
double PlayerSpeed = 0;
int PlayerPoints = 0;
double OpponentPos = 360;
double OpponentSpeed = 0;
PVector ball = new PVector(640, 360);
PVector ballSpeed = new PVector(0, 0);
PImage mouton1_6;
PImage mouton2_6;
int c_6 = 0;
//---------------------------------------------------------------------------------
// jeu7
//---------------------------------------------------------------------------------
int a_7=0;
float x_7=75; //position initial en X de l'oiseau
float y_7 = 2*(600/3); //position initial en Y de l'oiseau
float speed; //vitesse de l'oiseau a chaque saut
float angle; //angle par rapport a l'horizontal vers lequel l'oiseau saute
float ySpeed; //vitesse en y de l'oiseau (Newton)
float accel = 0; //acceleration de l'oiseau pour simuler la gravite (Newton)
PImage bird; //declaration de l'image de l'oiseau
PImage tube; //declaration de l'image des tubes
int[] tab_tubeX = new int[2]; //tableau comportant les positions en X des tubes
int[] tab_tubeY = new int[2]; //tableau comportant les positions en Y des tubes
int move_tube = 0; //vitesse des tubes en X
int score_7 = 0; //variable utile pour les scores
boolean over = false; //variable pour la fin de partie
//PFont fontflappy;
//---------------------------------------------------------------------------------
// jeu8
//---------------------------------------------------------------------------------
int x_8, y_8;
int taille_8 = 80;
int taille2_8;
PImage mouton_black, mouton_black_eyes;
int tmp_8 = 0;
//---------------------------------------------------------------------------------
// jeu9
//---------------------------------------------------------------------------------
int nbSheep = 8;
int compteur_9 = 0;
int indexListeReponse = 0;
int click = 0;
int flag = 0;
PImage red, green, blue, yellow, purple;
int[] listeCouleur;
int[] listeReponse;
int nbValeurVraie = 0;
int score12 = 0;
//---------------------------------------------------------------------------------
// jeu10
//---------------------------------------------------------------------------------
int numQuestion = 0; // de 0 a 2 pour les questions et >2 pour l'affichage de fin
String[] listeQuestion = {"La fourrure du mouton ne grandi pas indéfiniment", "Le champ de vision du mouton est de 360 degrés", "Les moutons ont un odorat très peu développé"};
PImage background1, background2, background3;
//---------------------------------------------------------------------------------
// retour menu
//---------------------------------------------------------------------------------
int i=0;
PImage fond0, fond1, fond2, fond3;
PImage bouton;
PImage Final;
int total_tmp=0;
void Final(){
Final=loadImage("niveaux.jpg");
background(Final);
textAlign(CENTER, CENTER);
total_tmp=score_general[0]+score_general[1]+score_general[2]+score_general[3]+score_general[4]+score_general[5]+score_general[6]+score_general[7]+score_general[8]+score_general[9];
println(total_tmp);
textSize(50);
text("Shaun le Mouton a réussi à rejoindre son troupeau\n\n\nVotre score est de : "+total_tmp,0,0,width,height);
stroke(0);
fill(255);
rect(width/2-100, height-100, 200, 60,10);
fill(0);
textSize(30);
text("QUITTER",width/2, height-100+30);
if (mouseX>=width/2-100 && mouseX<=width/2+100 && mouseY>=height-100 && mouseY<=height-100+60){
if (mousePressed==true)
exit();
}
textAlign(CORNER, CORNER);
}
void keyPressed() {
//----------------------------pour jeu 0 (menu des niveaux)-------------------------------
if (numJeu==0) {
}
//------------------------pour jeu 1------------------------------------------
if (numJeu==1) {
if (keyCode == UP)sheep.up = true;
if (keyCode == DOWN)sheep.down = true;
if (keyCode == RIGHT)sheep.right = true;
if (keyCode == LEFT)sheep.left = true;
}
//------------------------pour jeu 2-----------------------------------------
if (numJeu==2) {
if ( mur1!= pixelmurs && mur5!=pixelmurs) {
if (key == 'z' )
{
y2=y2-2;
//ellipse(x2, y2, 60, 60);
a2=a2-2;
//ellipse(z2, a2, 60, 60);
mur1=get(x2, y2-5);
}
}
if ( mur2!= pixelmurs && mur6!= pixelmurs ) {
if (key == 's')
{
y2=y2+2;
//ellipse(x2, y2, 60, 60);
a2=a2+2;
//ellipse(z2, a2, 60, 60);
}
}
if (mur4!= pixelmurs ) {
if (key == 'q')
{
x2=x2-2;
//ellipse(x2, y2, 60, 60);
}
}
if ( mur3!= pixelmurs ) {
if (key == 'd')
{
x2=x2+2;
//ellipse(x2, y2, 60, 60);
}
}
if ( mur8!= pixelmurs ) {
if (key == 'i')
{
z2=z2-2;
//ellipse(z2, a2, 60, 60);
}
}
if ( mur7!= pixelmurs ) {
if (key == 'p')
{
z2=z2+2;
//ellipse(z2, a2, 60, 60);
}
}
}
//--------------------------------pour jeu 3-------------------------------------
if (numJeu==3) {
if (key == ' ')
{
duree_3+=1;
x1_3=100;
x_3=-800;
if (duree_3%60==0)
{
x_3=100;
x1_3=-800;
fill(204, 250, 255);
rect(100, 340, 200, 200);
image(mouton1, x_3, 500, 200, 200);
duree_3=0;
}
}
if (key == 'a')
{
a_3=false;
}
}
//--------------------------pour jeu 4----------------------------------
if (numJeu==4) {
if (keyCode == UP)up = true;
if (keyCode == DOWN)down = true;
if (keyCode == LEFT)left = true;
if (keyCode == RIGHT)right = true;
}
//----------------------------pour jeu 5-------------------------------
if (numJeu==5) {
}
//----------------------------pour jeu 6--------------------------------
if (numJeu==6) {
}
//------------------------------pour jeu 7--------------------------------
if (numJeu==7) {
if (key == ' ' && over == false) { //test si la barre espace est pressée ET que la partie n'est pas perdu
ySpeed = speed * sin(radians(angle)); //loi de Newton pour la variation en y de l'oiseau
accel = 0.6;
move_tube = 2; //deplacement des tubes
}
if (key == ' ' && over == true) { //test si la barre espace est pressée ET que la partie est perdu
loop(); //on recommence a boucler le programme
x_7=75; //on réinitialise les valeurs
y_7 = 2*(600/3); //on réinitialise les valeurs
ySpeed = 0; //on réinitialise les valeurs
accel = 0; //on réinitialise les valeurs
move_tube = 0; //on réinitialise les valeurs
score_7 = 0; //on réinitialise les valeurs
over = false; //on réinitialise les valeurs
for (int i = 0; i<2; i++) {//initialisation des deux premiers tubes
tab_tubeX[i] = i*575/2 + 300; //on réinitialise les valeurs
tab_tubeY[i] = int(random(-550, -350)); //on réinitialise les valeurs
}
}
}
//-------------------------------pour jeu 8--------------------------------
if (numJeu==8) {
}
//----------------------------------pour jeu 9----------------------------
if (numJeu==9) {
}
//---------------------------------pour jeu 10------------------------------
if (numJeu==10) {
}
}
void keyReleased() {
//----------------------------pour jeu 1------------------------------------
if (numJeu==1) {
if (keyCode == UP)sheep.up = false;
if (keyCode == DOWN)sheep.down = false;
if (keyCode == RIGHT)sheep.right = false;
if (keyCode == LEFT)sheep.left = false;
}
//--------------------------pour jeu 2----------------------------------------
if (numJeu==2) {
}
//---------------------------pour jeu 3---------------------------------------
if (numJeu==3) {
x_3=100;
x1_3=-800;
duree_3=0;
}
//--------------------------pour jeu 4-----------------------------------------
if (numJeu==4) {
if (keyCode == UP)up = false;
if (keyCode == DOWN)down = false;
if (keyCode == LEFT)left = false;
if (keyCode == RIGHT)right = false;
}
//-----------------------pour jeu 5----------------------------------------
if (numJeu==5) {
}
//----------------------------pour jeu 6-------------------------------------
if (numJeu==6) {
}
//------------------------pour jeu 7---------------------------------------
if (numJeu==7) {
}
//--------------------------pour jeu 8----------------------------------
if (numJeu==8) {
}
//------------------------pour jeu 9-------------------------------------
if (numJeu==9) {
}
//---------------------pour jeu 10--------------------------------------
if (numJeu==10) {
}
}
void afficher_accueil()
{
//affichage nom et ecran d'acceuil
background(0);
fondecran = loadImage("Fond.jpg");
image(fondecran, 0, 0, 1400, 800);
fill(0);
textAlign(CENTER);
textSize(100);
text("Sheep'Game", 700, 450);
}
void quiVeutGagnerDesMoutons() {
numJeu=10;//jeu numéro 10
if (numQuestion == 0) {
image(background1, 0, 0, width, height);
fill(255, 90);
noStroke();
rect(50, 50, width - 100, height - 100, 50);
textAlign(CENTER, CENTER);
textSize(50);
fill(0);
text(listeQuestion[numQuestion], 50, 100, width - 100, height - 500);
strokeWeight(20);
if (dist(mouseX, mouseY, (1400/2)-200, 500)<100) {
fill(#64DB6C);
stroke(#5C9B60);
} else {
fill(#31C43C);
stroke(#12811A);
}
ellipse((1400/2)-200, 500, 200, 200);
fill(0);
text("Vrai", (1400/2)-300, 393, 200, 200);
if (dist(mouseX, mouseY, (1400/2)+200, 500)<100) {
fill(#EA5A5A);
stroke(#AD3434);
} else {
fill(#FC2626);
stroke(#6F1515);
}
ellipse((1400/2)+200, 500, 200, 200);
fill(0);
text("Faux", (1400/2)+100, 393, 200, 200);
}
else if (numQuestion == 1) {
image(background2, 0, 0, width, height);
fill(255, 90);
noStroke();
rect(50, 50, width - 100, height - 100, 50);
textAlign(CENTER, CENTER);
textSize(50);
fill(0);
text(listeQuestion[numQuestion], 50, 100, width - 100, height - 500);
strokeWeight(20);
if (dist(mouseX, mouseY, (1400/2)-200, 500)<100) {
fill(#64DB6C);
stroke(#5C9B60);
} else {
fill(#31C43C);
stroke(#12811A);
}
ellipse((1400/2)-200, 500, 200, 200);
fill(0);
text("Vrai", (1400/2)-300, 393, 200, 200);
if (dist(mouseX, mouseY, (1400/2)+200, 500)<100) {
fill(#EA5A5A);
stroke(#AD3434);
} else {
fill(#FC2626);
stroke(#6F1515);
}
ellipse((1400/2)+200, 500, 200, 200);
fill(0);
text("Faux", (1400/2)+100, 393, 200, 200);
}
else if (numQuestion == 2) {
image(background3, 0, 0, width, height);
fill(255, 90);
noStroke();
rect(50, 50, width - 100, height - 100, 50);
textAlign(CENTER, CENTER);
textSize(50);
fill(0);
text(listeQuestion[numQuestion], 50, 100, width - 100, height - 500);
strokeWeight(20);
if (dist(mouseX, mouseY, (1400/2)-200, 500)<100) {
fill(#64DB6C);
stroke(#5C9B60);
} else {
fill(#31C43C);
stroke(#12811A);
}
ellipse((1400/2)-200, 500, 200, 200);
fill(0);
text("Vrai", (1400/2)-300, 393, 200, 200);
if (dist(mouseX, mouseY, (1400/2)+200, 500)<100) {
fill(#EA5A5A);
stroke(#AD3434);
} else {
fill(#FC2626);
stroke(#6F1515);
}
ellipse((1400/2)+200, 500, 200, 200);
fill(0);
text("Faux", (1400/2)+100, 393, 200, 200);
}
else if(numQuestion > 2){
//mettre l'image de la fin en fonction du score
//score est stocké dans la variable score10
score_general[9] = score10;
suivant=true;
jeu10=false;
strokeWeight(1);
}
}
class Loup {
int x; //position en x
int y; // position en y
String look; // orientation du loup (up, down, left, right)
Loup(int x, int y, String orientation) {
this.x = x;
this.y = y;
this.look = orientation;
}
void display() {
stroke(59, 61, 56); //couleur du contour
strokeWeight(5); //taille du coutonr
fill(118, 117, 106); //couleur du loup
ellipse(this.x, this.y, 80, 80); //objet loup
}
void champVision() {
if (this.look == "up") {
noStroke();
fill(107, 183, 77);
triangle(this.x-100, this.y-200, this.x, this.y, this.x+100, this.y-200);
arc(this.x, this.y-101, 280, 280, 5*PI/4, 7*PI/4);
stroke(0);
fill(255);
} else if (this.look == "right") {
noStroke();
fill(107, 183, 77);
triangle(this.x+200, this.y-100, this.x, this.y, this.x+200, this.y+100);
arc(this.x+101, this.y, 280, 280, -1*PI/4, 1*PI/4);
stroke(0);
fill(255);
} else if (this.look == "down") {
noStroke();
fill(107, 183, 77);
triangle(this.x+100, this.y+200, this.x, this.y, this.x-100, this.y+200);
arc(this.x, this.y+101, 280, 280, 1*PI/4, 3*PI/4);
stroke(0);
fill(255);
} else if (this.look == "left") {
noStroke();
fill(107, 183, 77);
triangle(this.x-200, this.y-100, this.x, this.y, this.x-200, this.y+100);
arc(this.x-101, this.y, 280, 280, 3*PI/4, 5*PI/4);
stroke(0);
fill(255);
}
}
}
class Sheep {
int x; //position en x du mouton
int y; // position en y du mouton
boolean up = false;
boolean right = false;
boolean left = false;
boolean down = false;
Sheep(int x, int y) {
this.x = x;
this.y = y;
}
void display() {
fill(248, 235, 198);
strokeWeight(5);
stroke(188, 168, 135);
ellipse(this.x, this.y, 50, 50);
}
void move() {
if (this.up == true && sheep.y > 0)this.y-=2;
if (this.down == true && sheep.y < height)this.y+=2;
if (this.left == true && sheep.x > 0)this.x-=2;
if (this.right == true && sheep.x < width)this.x+=2;
}
void collision() {
for (int i = 0; i<12; i++) {
color c = get(int(this.x+(cos(i*PI/6))*26), int(this.y+(sin(i*PI/6))*26));//je récupère la couleur sur le contour du mouton
if (red(c) == 107 && green(c) == 183 && blue(c) == 77) { // si la couleur est egale a celle du champ de vision du loup on stop
//stop();
score_general[0]=0;
suivant=true;
jeu1=false;
}
}
}
}
void mouton_loups() {
numJeu=1;//jeu numéro 1
score1++;
background(75, 93, 59);
fill(#B45B16);
noStroke();
rect(0, 0, 100, 100);
loup1.champVision();
loup2.champVision();
loup3.champVision();
loup4.champVision();
loup5.champVision();
loup6.champVision();
loup7.champVision();
loup8.champVision();
loup9.champVision();
loup1.display();
loup2.display();
loup3.display();
loup4.display();
loup5.display();
loup6.display();
loup7.display();
loup8.display();
loup9.display();
sheep.display();
sheep.move();
sheep.collision();
if (sheep.x < 100 && sheep.x > 0 && sheep.y < 100 && sheep.y > 0) {
fill(0, 0, 0, 25);
rect(0, 0, width, height);
textSize(100);
textAlign(CENTER, CENTER);
fill(255);
scoreFinal = floor(score1/1200);
if (scoreFinal > 3)scoreFinalFinal = 1;
else scoreFinalFinal = 3-scoreFinal;
score1 = scoreFinalFinal;
//text("YOU WIN\nScore : "+score1, 0, 0, width, height);
score_general[0]=score1;
//stop();
suivant=true;
jeu1=false;
}
//ajout de move pour déplacement
loup1.x+=moveX_1;
loup1.y+=moveY_1;
loup2.x+=moveX_2;
loup2.y+=moveY_2;
loup3.x+=moveX_3;
loup3.y+=moveY_3;
loup4.x+=moveX_4;
loup4.y+=moveY_4;
loup5.x+=moveX_5;
loup5.y+=moveY_5;
loup6.x+=moveX_6;
loup6.y+=moveY_6;
loup7.x+=moveX_7;
loup7.y+=moveY_7;
loup8.x+=moveX_8;
loup8.y+=moveY_8;
loup9.x+=moveX_9;
loup9.y+=moveY_9;
/////////////////////////////////////////////////////////////
//1er loup
if (loup1.x == 1300 && loup1.y == 100) {
moveX_1 = 0;
moveY_1 = 2;
loup1.look = "down";
} else if (loup1.x == 1300 && loup1.y == 700) {
moveX_1 = -2;
moveY_1 = 0;
loup1.look = "left";
} else if (loup1.x == 1000 && loup1.y == 700) {
moveX_1 = 0;
moveY_1 = -2;
loup1.look = "up";
} else if (loup1.x == 1000 && loup1.y == 100) {
moveX_1 = 2;
moveY_1 = 0;
loup1.look = "right";
}
/////////////////////////////////////////////////////////////
//2eme loups
if (loup2.x == 900 && loup2.y == 700) {
moveX_2 = -1;
moveY_2 = 0;
loup2.look = "left";
} else if (loup2.x == 100 && loup2.y == 700) {
moveX_2 = 0;
moveY_2 = -1;
loup2.look = "up";
} else if (loup2.x == 100 && loup2.y == 500) {
moveX_2 = 1;
moveY_2 = 0;
loup2.look = "right";
} else if (loup2.x == 900 && loup2.y == 500) {
moveX_2 = 0;
moveY_2 = 1;
loup2.look = "down";
}
/////////////////////////////////////////////////////////////
//3eme loups
if (loup3.x == 300 && loup3.y == 100) {
moveX_3 = 0;
moveY_3 = 2;
loup3.look = "down";
} else if (loup3.x == 300 && loup3.y == 700) {
moveX_3 = 2;
moveY_3 = 0;
loup3.look = "right";
} else if (loup3.x == 700 && loup3.y == 700) {
moveX_3 = 0;
moveY_3 = -2;
loup3.look = "up";
} else if (loup3.x == 700 && loup3.y == 100) {
moveX_3 = -2;
moveY_3 = 0;
loup3.look = "left";
}
/////////////////////////////////////////////////////////////
//4eme loups
if (loup4.x == 200 && loup4.y == 200) {
moveX_4 = 1;
moveY_4 = 0;
loup4.look = "right";
} else if (loup4.x == 1100 && loup4.y == 200) {
moveX_4 = 0;
moveY_4 = 1;
loup4.look = "down";
} else if (loup4.x == 1100 && loup4.y == 400) {
moveX_4 = -1;
moveY_4 = 0;
loup4.look = "left";
} else if (loup4.x == 200 && loup4.y == 400) {
moveX_4 = 0;
moveY_4 = -1;
loup4.look = "up";
}
/////////////////////////////////////////////////////////////
//5eme loups // line(900, 400, 1200, 400);
if (loup5.x == 1200 && loup5.y == 400) {
moveX_5 = -1;
loup5.look = "left";
} else if (loup5.x == 900 && loup5.y == 400) {
moveX_5 = 1;
loup5.look = "right";
}
/////////////////////////////////////////////////////////////
//6eme loups // line(800, 100, 800, 700);
if (loup6.x == 800 && loup6.y == 700) {
moveY_6 = -1;
loup6.look = "up";
} else if (loup6.x == 800 && loup6.y == 100) {
moveY_6 = 1;
loup6.look = "down";
}
/////////////////////////////////////////////////////////////
//7eme loups // line(100, 600, 1300, 600);
if (loup7.x == 100 && loup7.y == 600) {
moveX_7 = 1;
loup7.look = "right";
} else if (loup7.x == 1300 && loup7.y == 600) {
moveX_7 = -1;
loup7.look = "left";
}
/////////////////////////////////////////////////////////////
//8eme loups // line(200, 300, 1200, 300);
if (loup8.x == 1200 && loup8.y == 300) {
moveX_8 = -1;
loup8.look = "left";
} else if (loup8.x == 200 && loup8.y == 300) {
moveX_8 = 1;
loup8.look = "right";
}
/////////////////////////////////////////////////////////////
//9eme loups // line(100, 100, 100, 700);
if (loup9.x == 100 && loup9.y == 700) {
moveY_9 = -1;
loup9.look = "up";
} else if (loup9.x == 100 && loup9.y == 100) {
moveY_9 = 1;
loup9.look = "down";
}
}
void deplacement_separe()
{
numJeu=2;//jeu numéro 2
if (test!=true) {
background(185,122,87);
fill(0);
textAlign(CENTER);
textSize(100);
text("Règles du jeu :", 700, 100);
textSize(40);
text("Vous déplacez vers le haut et le bas les 2 moutons avec Z et S", 700, 200);
textSize(40);
text("Vous déplacez vers la droite et la gauche le mouton de gauche Q et D", 700, 300);
textSize(40);
text("Vous déplacez vers la droite et la gauche le mouton de droite I et P", 700, 400);
textSize(70);
text("Appuyez sur espace pour commencer", 700, 600);
}
if (key== ' ') {
test=true;
}
if (test==true) {
compteur=compteur+0.16;
//affichage labyrinthe fond
mirroir=loadImage("mirroir.png");
image(mirroir, 0, 0, 1400, 800);
fill(248, 235, 198);
ellipse(x2, y2, 60, 60);
ellipse(z2, a2, 60, 60);
//definition des impacts au mur pour mouton gauche
mur1=get(x2, y2-35);
mur2=get(x2, y2+35);
mur3=get(x2+35, y2);
mur4=get(x2-35, y2);
//definition des impacts au mur pour mouton droite
mur5=get(z2, a2-35);
mur6=get(z2, a2+35);
mur7=get(z2+35, y2);
mur8=get(z2-35, y2);
if (y2<=30)
{
if (compteur<120)
{
score2=3;
}
if (compteur>120 && compteur<150)
{
score2=2;
}
if (compteur>150)
{
score2=1;
}
score_general[1]=score2;
jeu2=false;
suivant=true;
}
}
}
void regles()