ajout commentaire + organisation du code + réglage menu pause
This commit is contained in:
parent
b9e58985ea
commit
95411d5a1f
Binary file not shown.
@ -8,7 +8,7 @@
|
||||
void InitialiserOeufs(int oeufx[], int oeufy[], int segment) {
|
||||
int p;
|
||||
int oeuf;
|
||||
/*Boucles qui initialse 5 pommes aléatoirement*/
|
||||
/*Boucles qui initialse 5 oeufs aléatoirement*/
|
||||
for (p = 0; p < 5; p++) {
|
||||
oeufx[p] = ((rand() % (55) + 1) * 20);
|
||||
oeufy[p] = ((rand() % (35) + 1) * 20);
|
||||
|
@ -59,6 +59,7 @@ int lancer_jeu(){
|
||||
Serpent(pos_x, pos_y, old_x, old_y, pointeur_segment, murx, mury, &go_on, pointeur_direction);
|
||||
bordure(segment);
|
||||
Update_Serpent(pos_x, pos_y, segment, old_x, old_y, pointeur_direction);
|
||||
/*Lancement du jeu*/
|
||||
while(go_on==1){
|
||||
Controle(pointeur_direction, 0, &go_on, pointeur_pause);
|
||||
if(pause == 1){
|
||||
@ -90,5 +91,4 @@ int main(void){
|
||||
lancer_jeu();
|
||||
}
|
||||
FermerGraphique();
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <graph.h>
|
||||
|
||||
#include "../fichier.h/main.h"
|
||||
@ -19,7 +18,6 @@ int Menu(void) {
|
||||
int choix = 1;
|
||||
InitialiserGraphique();
|
||||
Menu_debut();
|
||||
|
||||
while (1) {
|
||||
if (ToucheEnAttente()) {
|
||||
int touche = Touche();
|
||||
@ -27,8 +25,7 @@ int Menu(void) {
|
||||
case XK_e:
|
||||
choix = 1;
|
||||
return choix;
|
||||
case XK_q: /* Changement de XK_q à XK_a*/
|
||||
/*Code pour traiter la touche "a" (fermer le jeu, par exemple)*/
|
||||
case XK_q:
|
||||
FermerGraphique();
|
||||
return choix;
|
||||
}
|
||||
|
@ -79,7 +79,6 @@ 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) {
|
||||
@ -109,7 +108,7 @@ void Controle(int *direction, int last_direction, int *go_on, int *pause) {
|
||||
return;
|
||||
case XK_space :
|
||||
*pause = 1;
|
||||
AfficherSprite(Pause, 400, 720);
|
||||
ChargerImage("img/PAUSE.png", 400,720,0,0,400,150);
|
||||
while(*pause){
|
||||
t = Touche();
|
||||
if (t == XK_space){
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <graph.h>
|
||||
#include <time.h>
|
||||
#include <graph.h>
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <graph.h>
|
||||
|
||||
#include "../fichier.h/time.h"
|
||||
#include "../fichier.h/main.h"
|
||||
#include "../fichier.h/serpent.h"
|
||||
#define CYCLE 1000000L
|
||||
|
||||
/*Affichage du score*/
|
||||
void Score(int segment){
|
||||
int nombre;
|
||||
char score[4];
|
||||
|
Loading…
Reference in New Issue
Block a user