Commit c3040ffaee534eae000268533bf2a003dac89028
1 parent
44eb975c
avec game over
Showing
10 changed files
with
367 additions
and
80 deletions
Show diff stats
projets/Centipede/centipede
No preview for this file type
projets/Centipede/progprinc.c
@@ -33,24 +33,28 @@ int main() { | @@ -33,24 +33,28 @@ int main() { | ||
33 | int hauteur = 1000; | 33 | int hauteur = 1000; |
34 | liste_champi muschrooms={.nombre=0}; | 34 | liste_champi muschrooms={.nombre=0}; |
35 | liste_t listecenti={NULL,0,0}; | 35 | liste_t listecenti={NULL,0,0}; |
36 | - int h,w,l,i; | 36 | + int h,w,l,i,t, allonge; |
37 | + int s=0; | ||
37 | char *titre = "Le Centipède"; | 38 | char *titre = "Le Centipède"; |
38 | 39 | ||
39 | 40 | ||
40 | int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); | 41 | int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); |
41 | int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); | 42 | int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); |
42 | -/* int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); | 43 | + int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); |
43 | int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); | 44 | int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); |
44 | int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); | 45 | int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); |
45 | - int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); */ | 46 | + int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); |
46 | int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); | 47 | int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); |
47 | -/* int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); | ||
48 | - int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); */ | 48 | + int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); |
49 | + int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); | ||
50 | + int gameover = chargerLutin("Lutins/game_over.bmp",0); | ||
51 | + int Tete; | ||
52 | + int Corps; | ||
53 | + int abs, ord, obstacle, couleur; | ||
54 | + | ||
55 | + if(champi<0 || Teted<0 || Teteg<0 || Teteh <0 || Teteb<0 || Corpsg<0 || Corpsd<0 || Corpsh<0 || Corpsb<0 || gameover<0){ printf("Image pas là\n"); exit(-1); } | ||
49 | 56 | ||
50 | - if(champi<0){ printf("Champi pas là\n"); exit(-1); } | ||
51 | tailleLutin(champi,&l,&h); | 57 | tailleLutin(champi,&l,&h); |
52 | - | ||
53 | - | ||
54 | position *pos; | 58 | position *pos; |
55 | position poschampi; | 59 | position poschampi; |
56 | position posmillepatte; | 60 | position posmillepatte; |
@@ -60,18 +64,18 @@ int main() { | @@ -60,18 +64,18 @@ int main() { | ||
60 | int x = 300; | 64 | int x = 300; |
61 | int y = 500; | 65 | int y = 500; |
62 | 66 | ||
63 | - for(i=0; i<4; i++) | ||
64 | - { | ||
65 | - posmillepatte.x = (x + 50*i); | ||
66 | - posmillepatte.y = y; | ||
67 | - enfiler(&listecenti,&posmillepatte,sizeof(position)); | ||
68 | - } | 67 | + for(i=0; i<4; i++) |
68 | + { | ||
69 | + posmillepatte.x = (x + 50*i); | ||
70 | + posmillepatte.y = y; | ||
71 | + enfiler(&listecenti,&posmillepatte,sizeof(position)); | ||
72 | + } | ||
69 | //affichage des corpsd du centipede | 73 | //affichage des corpsd du centipede |
70 | - for(i=0; i<4; i++) | ||
71 | - { | ||
72 | - pos = enieme(i,&listecenti); | ||
73 | - afficherLutin(Corpsd,pos->x,pos->y); | ||
74 | - } | 74 | + for(i=0; i<4; i++) |
75 | + { | ||
76 | + pos = enieme(i,&listecenti); | ||
77 | + afficherLutin(Corpsd,pos->x,pos->y); | ||
78 | + } | ||
75 | 79 | ||
76 | posmillepatte.x = (x+200); | 80 | posmillepatte.x = (x+200); |
77 | posmillepatte.y = y; | 81 | posmillepatte.y = y; |
@@ -79,76 +83,135 @@ int main() { | @@ -79,76 +83,135 @@ int main() { | ||
79 | pos = enieme(4, &listecenti); | 83 | pos = enieme(4, &listecenti); |
80 | afficherLutin(Teted,pos->x,pos->y); | 84 | afficherLutin(Teted,pos->x,pos->y); |
81 | 85 | ||
82 | - for(i = 0 ; i < 20; i++) | ||
83 | - { | ||
84 | - rectanglePlein(i*50,0,1,1000,5); //pose de la grille | ||
85 | - rectanglePlein(0,i*50,1000,1,5); | ||
86 | - } | ||
87 | - | ||
88 | - for(w=0;w<10;w++) { | ||
89 | - poschampi.x = (rand()%20)*50; //fixe coordonnées des champignons | ||
90 | - poschampi.y = (rand()%20)*50; | ||
91 | - if(poschampi.y > 550 || poschampi.y < 450) { | ||
92 | - muschrooms.contenu[muschrooms.nombre++]=poschampi; } | ||
93 | - else w--; | ||
94 | - } | 86 | +/* for(i = 0 ; i < 20; i++) |
87 | + { | ||
88 | + rectanglePlein(i*50,0,1,1000,5); //pose de la grille | ||
89 | + rectanglePlein(0,i*50,1000,1,5); | ||
90 | + } */ | ||
91 | + | ||
92 | + | ||
93 | + for(w=0;w<20;w++) | ||
94 | + { | ||
95 | + poschampi.x = (rand()%20)*50; //fixe coordonnées des champignons | ||
96 | + poschampi.y = (rand()%20)*50; | ||
97 | + if(poschampi.y > 570 || poschampi.y < 430) | ||
98 | + { | ||
99 | + muschrooms.contenu[muschrooms.nombre++]=poschampi; | ||
100 | + afficherLutin(champi,(muschrooms.contenu[w].x)+1,(muschrooms.contenu[w].y)+6); | ||
101 | + } | ||
102 | + else w--; | ||
103 | + } | ||
95 | 104 | ||
96 | printf("%d %d \n",l,h); | 105 | printf("%d %d \n",l,h); |
97 | - | ||
98 | - for(w=0;w<10;w++){ | ||
99 | - afficherLutin(champi,(muschrooms.contenu[w].x)+1,(muschrooms.contenu[w].y)+6); | ||
100 | - }//affiche les champis | ||
101 | - majSurface(); | ||
102 | - | ||
103 | - int gomme = creerLutin(0,0,50,50,0); | ||
104 | - majSurface(); | 106 | + //affiche les champis |
107 | + for(w=0;w<20;w++) | ||
108 | + { | ||
109 | + printf("les coordonnées de mes champis : %d %d \n", (muschrooms.contenu[w].x),(muschrooms.contenu[w].y)); | ||
110 | + } | ||
111 | + | ||
112 | + majSurface(); | ||
113 | + | ||
114 | + int gomme = creerLutin(0,0,50,50,-1); | ||
115 | + | ||
116 | +/* afficherLutin(Corpsd,0,0) | ||
117 | + int couleurcd = couleurPixel(25,25); | ||
118 | + majSurface(); | ||
119 | + afficherLutin(gomme,0,0); | ||
120 | + majSurface(); | ||
121 | + | ||
122 | + afficherLutin(Corpsg,0,0) | ||
123 | + int couleurcg = couleurPixel(25,25); | ||
124 | + majSurface(); | ||
125 | + afficherLutin(gomme,0,0); | ||
126 | + majSurface(); | ||
127 | + | ||
128 | + afficherLutin(Corpsh,0,0) | ||
129 | + int couleurch = couleurPixel(25,25); | ||
130 | + majSurface(); | ||
131 | + afficherLutin(gomme,0,0); | ||
132 | + majSurface(); | ||
133 | + | ||
134 | + afficherLutin(Corpsb,0,0) | ||
135 | + int couleurcb = couleurPixel(25,25); | ||
136 | + majSurface(); | ||
137 | + afficherLutin(gomme,0,0); | ||
138 | + majSurface(); */ | ||
139 | + | ||
140 | + majSurface(); | ||
105 | 141 | ||
106 | 142 | ||
107 | 143 | ||
108 | while(1){ | 144 | while(1){ |
109 | - if(lireTouche(&bas,&touche,(void **)&detail) && bas==1) { | ||
110 | - | ||
111 | - if(detail->sym==SDLK_RIGHT) { | ||
112 | - printf("dans le droite\n"); | ||
113 | - pos = premier(&listecenti); | ||
114 | - afficherLutin(gomme,pos->x,pos->y); | ||
115 | - defiler(&listecenti); | ||
116 | - | ||
117 | - pos = dernier(&listecenti); | ||
118 | - afficherLutin(gomme,pos->x,pos->y); | ||
119 | - afficherLutin(Corpsd,(pos->x),pos->y); | ||
120 | - posmillepatte.x = pos->x+50; | ||
121 | - posmillepatte.y = pos->y; | ||
122 | - enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
123 | - afficherLutin(Teted,posmillepatte.x,posmillepatte.y); | ||
124 | - majSurface(); | ||
125 | - } | ||
126 | - | ||
127 | - if(detail->sym==SDLK_LEFT) { | ||
128 | - | ||
129 | - } | ||
130 | - | ||
131 | - if(detail->sym==SDLK_UP) { | ||
132 | - | ||
133 | - } | ||
134 | - | ||
135 | - if(detail->sym==SDLK_DOWN) { | ||
136 | - | ||
137 | - } | ||
138 | - | ||
139 | - | ||
140 | - | 145 | + if(lireTouche(&bas,&touche,(void **)&detail) && bas==1) |
146 | + { | ||
147 | + if(detail->sym==SDLK_RIGHT) t=0; | ||
148 | + if(detail->sym==SDLK_UP) t=1; | ||
149 | + if(detail->sym==SDLK_LEFT) t=2; | ||
150 | + if(detail->sym==SDLK_DOWN) t=3; | ||
151 | + } | ||
152 | + | ||
153 | + usleep(200000); | ||
154 | + | ||
155 | + if((t==0 && s!=2) || s==0) { abs=50; ord=0; Tete = Teted; Corps = Corpsd; s=0; } | ||
156 | + if((t==1 && s!=3) || s==1) { abs=0; ord=(-50); Tete = Teteh; Corps = Corpsh; s=1; } | ||
157 | + if((t==2 && s!=0) || s==2) { abs=-50; ord=0; Tete = Teteg; Corps = Corpsg; s=2; } | ||
158 | + if((t==3 && s!=1) || s==3) { abs=0; ord=50; Tete = Teteb; Corps = Corpsb; s=3; } | ||
159 | + | ||
160 | + pos = dernier(&listecenti); | ||
161 | + posmillepatte.x = pos->x+abs; | ||
162 | + posmillepatte.y = pos->y+ord; | ||
163 | + if(posmillepatte.x==1000 || posmillepatte.y==1000 || posmillepatte.x==-50 || posmillepatte.y==-50) | ||
164 | + { | ||
165 | + afficherLutin(gameover,250,433); | ||
166 | + majSurface(); | ||
167 | + sleep(5); | ||
168 | + fermerSurface(); | ||
169 | + } | ||
170 | + | ||
171 | + majSurface(); | ||
172 | + couleur = couleurPixel(posmillepatte.x+25,posmillepatte.y+25); | ||
173 | + printf("la couleur est %d\n",couleur); | ||
174 | + if(couleur!=1) obstacle = 1; | ||
175 | + else obstacle = 0; | ||
176 | + allonge = 0; | ||
177 | + | ||
178 | + if(obstacle==1){ | ||
179 | + for(w=0;w<20;w++) | ||
180 | + { | ||
181 | + if((muschrooms.contenu[w].x) == posmillepatte.x && (muschrooms.contenu[w].y) == posmillepatte.y) { allonge = 1; } } | ||
182 | + if(allonge==1){ | ||
183 | + afficherLutin(gomme,pos->x,pos->y); | ||
184 | + afficherLutin(Corps,(pos->x),pos->y); | ||
185 | + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
186 | + afficherLutin(Tete,posmillepatte.x,posmillepatte.y); | ||
187 | + } | ||
188 | + else { | ||
189 | + afficherLutin(gameover,250,433); | ||
190 | + majSurface(); | ||
191 | + sleep(5); | ||
192 | + fermerSurface(); | ||
193 | + } | ||
194 | + | ||
195 | + } | ||
196 | + | ||
197 | + if(obstacle==0){ | ||
198 | + afficherLutin(gomme,pos->x,pos->y); | ||
199 | + afficherLutin(Corps,(pos->x),pos->y); | ||
200 | + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
201 | + afficherLutin(Tete,posmillepatte.x,posmillepatte.y); | ||
202 | + pos = premier(&listecenti); | ||
203 | + afficherLutin(gomme,pos->x,pos->y); | ||
204 | + defiler(&listecenti); | ||
205 | + } | ||
206 | + majSurface(); | ||
141 | 207 | ||
142 | if(touche=='a') | 208 | if(touche=='a') |
143 | { | 209 | { |
144 | fermerSurface(); //condition d'arret | 210 | fermerSurface(); //condition d'arret |
145 | - return 0; | ||
146 | - | 211 | + return 0; |
147 | } | 212 | } |
148 | - }} | ||
149 | - | ||
150 | - | 213 | +} |
151 | return 0; | 214 | return 0; |
152 | } | 215 | } |
153 | 216 | ||
154 | - | 217 | - |
218 | + | ||
155 | \ No newline at end of file | 219 | \ No newline at end of file |
@@ -0,0 +1,224 @@ | @@ -0,0 +1,224 @@ | ||
1 | +#include <stdio.h> | ||
2 | +#include <stdlib.h> | ||
3 | +#include <libFile.h> | ||
4 | +#include <libgraph.h> | ||
5 | +#include <unistd.h> | ||
6 | +#include <time.h> | ||
7 | +#include <SDL/SDL.h> | ||
8 | +#define MAX_ELEMENTS 50 | ||
9 | + | ||
10 | +typedef struct { | ||
11 | + int x; | ||
12 | + int y; | ||
13 | +}position; | ||
14 | + | ||
15 | +typedef struct { | ||
16 | + position contenu[MAX_ELEMENTS]; | ||
17 | + int nombre; | ||
18 | + } liste_champi; | ||
19 | + | ||
20 | +void affichage(element_t e) | ||
21 | +{ | ||
22 | + position *p = e; | ||
23 | + printf("%d %d \n", p->x, p->y); | ||
24 | +} | ||
25 | + | ||
26 | + | ||
27 | +int main() { | ||
28 | + SDL_keysym* detail; | ||
29 | + srand(time(NULL)); | ||
30 | + char touche; | ||
31 | + unsigned char bas; | ||
32 | + int largeur = 1000; | ||
33 | + int hauteur = 1000; | ||
34 | + liste_champi muschrooms={.nombre=0}; | ||
35 | + liste_t listecenti={NULL,0,0}; | ||
36 | + int h,w,l,i,t; | ||
37 | + int s=10; | ||
38 | + char *titre = "Le Centipède"; | ||
39 | + | ||
40 | + | ||
41 | + int champi = chargerLutin("Lutins/millepatte_champi.bmp",0); | ||
42 | + int Teted = chargerLutin("Lutins/millepatte_tete_droite.bmp",0); | ||
43 | + int Teteg = chargerLutin("Lutins/millepatte_tete_gauche.bmp",0); | ||
44 | + int Teteh = chargerLutin("Lutins/millepatte_tete_haut.bmp",0); | ||
45 | + int Teteb = chargerLutin("Lutins/millepatte_tete_bas.bmp",0); | ||
46 | + int Corpsg = chargerLutin("Lutins/millepatte_corps_gauche.bmp",0); | ||
47 | + int Corpsd = chargerLutin("Lutins/millepatte_corps_droite.bmp",0); | ||
48 | + int Corpsh = chargerLutin("Lutins/millepatte_corps_haut.bmp",0); | ||
49 | + int Corpsb = chargerLutin("Lutins/millepatte_corps_bas.bmp",0); | ||
50 | + int gameover = chargerLutin("Lutins/game_over.bmp",0); | ||
51 | + | ||
52 | + if(champi<0){ printf("Champi pas là\n"); exit(-1); } | ||
53 | + tailleLutin(champi,&l,&h); | ||
54 | + | ||
55 | + | ||
56 | + position *pos; | ||
57 | + position poschampi; | ||
58 | + position posmillepatte; | ||
59 | + | ||
60 | + creerSurface(largeur,hauteur,titre); | ||
61 | + | ||
62 | + int x = 300; | ||
63 | + int y = 500; | ||
64 | + | ||
65 | + for(i=0; i<4; i++) | ||
66 | + { | ||
67 | + posmillepatte.x = (x + 50*i); | ||
68 | + posmillepatte.y = y; | ||
69 | + enfiler(&listecenti,&posmillepatte,sizeof(position)); | ||
70 | + } | ||
71 | + //affichage des corpsd du centipede | ||
72 | + for(i=0; i<4; i++) | ||
73 | + { | ||
74 | + pos = enieme(i,&listecenti); | ||
75 | + afficherLutin(Corpsd,pos->x,pos->y); | ||
76 | + } | ||
77 | + | ||
78 | + posmillepatte.x = (x+200); | ||
79 | + posmillepatte.y = y; | ||
80 | + enfiler(&listecenti,&posmillepatte,sizeof(position)); //affichage de la tete du Centipède | ||
81 | + pos = enieme(4, &listecenti); | ||
82 | + afficherLutin(Teted,pos->x,pos->y); | ||
83 | + | ||
84 | + for(i = 0 ; i < 20; i++) | ||
85 | + { | ||
86 | + rectanglePlein(i*50,0,1,1000,5); //pose de la grille | ||
87 | + rectanglePlein(0,i*50,1000,1,5); | ||
88 | + } | ||
89 | + | ||
90 | + for(w=0;w<10;w++) { | ||
91 | + poschampi.x = (rand()%20)*50; //fixe coordonnées des champignons | ||
92 | + poschampi.y = (rand()%20)*50; | ||
93 | + if(poschampi.y > 570 || poschampi.y < 430) { | ||
94 | + muschrooms.contenu[muschrooms.nombre++]=poschampi; } | ||
95 | + else w--; | ||
96 | + } | ||
97 | + | ||
98 | + printf("%d %d \n",l,h); | ||
99 | + | ||
100 | + for(w=0;w<10;w++){ | ||
101 | + afficherLutin(champi,(muschrooms.contenu[w].x)+1,(muschrooms.contenu[w].y)+6); | ||
102 | + }//affiche les champis | ||
103 | + majSurface(); | ||
104 | + | ||
105 | + int gomme = creerLutin(0,0,50,50,0); | ||
106 | + majSurface(); | ||
107 | + | ||
108 | + | ||
109 | + | ||
110 | + while(1){ | ||
111 | + if(lireTouche(&bas,&touche,(void **)&detail) && bas==1) { | ||
112 | + | ||
113 | + if(detail->sym==SDLK_RIGHT) t=0; | ||
114 | + if(detail->sym==SDLK_UP) t=1; | ||
115 | + if(detail->sym==SDLK_LEFT) t=2; | ||
116 | + if(detail->sym==SDLK_DOWN) t=3; } | ||
117 | + | ||
118 | + usleep(500000); | ||
119 | + | ||
120 | + if((t==0 && s!=2) || s==0) { | ||
121 | + printf("dans le droite\n"); | ||
122 | + pos = premier(&listecenti); | ||
123 | + afficherLutin(gomme,pos->x,pos->y); | ||
124 | + defiler(&listecenti); | ||
125 | + | ||
126 | + pos = dernier(&listecenti); | ||
127 | + afficherLutin(gomme,pos->x,pos->y); | ||
128 | + afficherLutin(Corpsd,(pos->x),pos->y); | ||
129 | + posmillepatte.x = pos->x+50; | ||
130 | + posmillepatte.y = pos->y; | ||
131 | + if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ | ||
132 | + afficherLutin(gameover,400,400); | ||
133 | + majSurface(); | ||
134 | + sleep(5); | ||
135 | + fermerSurface(); | ||
136 | + } | ||
137 | + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
138 | + afficherLutin(Teted,posmillepatte.x,posmillepatte.y); | ||
139 | + majSurface(); | ||
140 | + s=0; | ||
141 | + } | ||
142 | + | ||
143 | + if((t==1 && s!=3) || s==1) { | ||
144 | + printf("dans le haut\n"); | ||
145 | + pos = premier(&listecenti); | ||
146 | + afficherLutin(gomme,pos->x,pos->y); | ||
147 | + defiler(&listecenti); | ||
148 | + | ||
149 | + pos = dernier(&listecenti); | ||
150 | + afficherLutin(gomme,pos->x,pos->y); | ||
151 | + afficherLutin(Corpsh,(pos->x),pos->y); | ||
152 | + posmillepatte.x = pos->x; | ||
153 | + posmillepatte.y = pos->y-50; | ||
154 | + if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ | ||
155 | + afficherLutin(gameover,400,400); | ||
156 | + majSurface(); | ||
157 | + sleep(5); | ||
158 | + fermerSurface(); | ||
159 | + } | ||
160 | + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
161 | + afficherLutin(Teteh,posmillepatte.x,posmillepatte.y); | ||
162 | + majSurface(); | ||
163 | + s=1; | ||
164 | + } | ||
165 | + | ||
166 | + if((t==2 && s!=0) || s==2) { | ||
167 | + printf("dans le gauche\n"); | ||
168 | + pos = premier(&listecenti); | ||
169 | + afficherLutin(gomme,pos->x,pos->y); | ||
170 | + defiler(&listecenti); | ||
171 | + | ||
172 | + pos = dernier(&listecenti); | ||
173 | + afficherLutin(gomme,pos->x,pos->y); | ||
174 | + afficherLutin(Corpsg,(pos->x),pos->y); | ||
175 | + posmillepatte.x = pos->x-50; | ||
176 | + posmillepatte.y = pos->y; | ||
177 | + if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ | ||
178 | + afficherLutin(gameover,400,400); | ||
179 | + majSurface(); | ||
180 | + sleep(5); | ||
181 | + fermerSurface(); | ||
182 | + } | ||
183 | + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
184 | + afficherLutin(Teteg,posmillepatte.x,posmillepatte.y); | ||
185 | + majSurface(); | ||
186 | + s=2; | ||
187 | + } | ||
188 | + | ||
189 | + if((t==3 && s!=1) || s==3) { | ||
190 | + printf("dans le bas\n"); | ||
191 | + pos = premier(&listecenti); | ||
192 | + afficherLutin(gomme,pos->x,pos->y); | ||
193 | + defiler(&listecenti); | ||
194 | + | ||
195 | + pos = dernier(&listecenti); | ||
196 | + afficherLutin(gomme,pos->x,pos->y); | ||
197 | + afficherLutin(Corpsb,(pos->x),pos->y); | ||
198 | + posmillepatte.x = pos->x; | ||
199 | + posmillepatte.y = pos->y+50; | ||
200 | + if(posmillepatte.x > 1000 || posmillepatte.y > 1000 || posmillepatte.x < 0 || posmillepatte.y < 0){ | ||
201 | + afficherLutin(gameover,400,400); | ||
202 | + majSurface(); | ||
203 | + sleep(5); | ||
204 | + fermerSurface(); | ||
205 | + } | ||
206 | + enfiler(&listecenti,&posmillepatte,sizeof(posmillepatte)); | ||
207 | + afficherLutin(Teteb,posmillepatte.x,posmillepatte.y); | ||
208 | + majSurface(); | ||
209 | + s=3; | ||
210 | + } | ||
211 | + | ||
212 | + if(touche=='a') | ||
213 | + { | ||
214 | + fermerSurface(); //condition d'arret | ||
215 | + return 0; | ||
216 | + | ||
217 | + } | ||
218 | +} | ||
219 | + | ||
220 | + | ||
221 | + return 0; | ||
222 | +} | ||
223 | + | ||
224 | + |
projets/Centipede/progprinc.o
No preview for this file type
projets/Graphique/libgraph.a
No preview for this file type
projets/Liste/libFile.c
@@ -13,8 +13,8 @@ element_t nouveau=malloc(taille); | @@ -13,8 +13,8 @@ element_t nouveau=malloc(taille); | ||
13 | memcpy(nouveau,e,taille); | 13 | memcpy(nouveau,e,taille); |
14 | if (l->nombre >= l->alloue) | 14 | if (l->nombre >= l->alloue) |
15 | { | 15 | { |
16 | - l->contenu = realloc(l->contenu, l->alloue+100); | ||
17 | - l->alloue+=100; | 16 | + l->contenu = realloc(l->contenu, l->alloue+300); |
17 | + l->alloue+=300; | ||
18 | } | 18 | } |
19 | l->contenu[l->nombre++]=nouveau; | 19 | l->contenu[l->nombre++]=nouveau; |
20 | return 0; | 20 | return 0; |
projets/Liste/libFile.o
No preview for this file type
projets/Liste/libListe.a
No preview for this file type
No preview for this file type
No preview for this file type