JEU Finis manque la notice

This commit is contained in:
JUDE CHRIST AISSI 2023-12-22 16:27:53 +01:00
parent e6e209067f
commit 15da776376
6 changed files with 26 additions and 16 deletions

View File

@ -1,5 +0,0 @@
#ifndef FONCTIONS_H
#define FONCTIONS_H
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 84 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

View File

@ -8,6 +8,7 @@
#include "../fichier.h/time.h"
#include "../fichier.h/main.h"
#include "../fichier.h/menu.h"
#include "../fichier.h/terrain.h"
#define CYCLE 100000L
#define DELAI_MILLISECONDES 100
@ -67,7 +68,16 @@ int lancer_jeu(){
Collision_Serpent(pos_x, pos_y, segment, murx, mury, &go_on);
attente(DELAI_MILLISECONDES);
Oeuf(pos_x, pos_y, oeufx, oeufy, pointeur_segment);
}else{
Controle(pointeur_direction, 0, &go_on, pointeur_pause);
Timer( pointeur_minute, pointeur_seconde, pointeur_suivant, pointeur_seconde_actuel, pointeur_old_seconde, timer);
Update_Serpent(pos_x, pos_y, segment, old_x, old_y, pointeur_direction);
dessinerSerpent(pos_x, pos_y, segment, old_x, old_y);
Collision_Serpent(pos_x, pos_y, segment, murx, mury, &go_on);
attente(DELAI_MILLISECONDES);
Oeuf(pos_x, pos_y, oeufx, oeufy, pointeur_segment);
}
}
}
int main(void){

View File

@ -56,22 +56,22 @@ void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mu
int i;
/*Serpent contre coté*/
if (pos_x[0] >1160 || pos_x[0]<=0){
*go_on=0;
*go_on = 0;
}
/*Serpent contre coté*/
if (pos_y[0]<20 || pos_y[0] >=720){
*go_on=0;
*go_on = 0;
}
/*Serpent contre Serpent*/
for (i = 1; i < segment; i++) {
if (pos_x[0] == pos_x[i] && pos_y[0] == pos_y[i]){
*go_on = 0;
*go_on = 0;
}
}
/*Serpent contre mur*/
for(i=0; i<30;i++){
if(pos_x[0] == murx[i] && pos_y[0] == mury[i]){
*go_on=0;
*go_on = 0;
}
}
return;
@ -79,6 +79,7 @@ void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mu
void Controle(int *direction, int last_direction, int *go_on, int *pause) {
int t;
int Pause = ChargerSprite("img/PAUSE.png");
while(ToucheEnAttente()) {
t = Touche();
switch(t) {
@ -106,13 +107,17 @@ void Controle(int *direction, int last_direction, int *go_on, int *pause) {
*direction = 0;
*go_on = 0;
return;
case XK_space:
if (*pause == 0 ){
*pause == 1;
}else{
*pause = 0;
ChargerImage("img/PAUSE.png", 400,200,0,0,350,300);
}
case XK_space :
*pause = 1;
AfficherSprite(Pause, 400, 720);
while(*pause){
t = Touche();
if (t == XK_space){
*pause = 0;
ChoisirCouleurDessin(CouleurParNom("black"));
RemplirRectangle(200,720,800,200);
}
}
}
}
}