réglage collision + ajout tête serpent
This commit is contained in:
@@ -10,33 +10,40 @@ void Update_Serpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_
|
||||
|
||||
if (*direction == 1){
|
||||
pos_y[0]=old_y[0]-20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
if (*direction == 2) {
|
||||
pos_y[0]=old_y[0]+20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
if (*direction == 3) {
|
||||
pos_x[0]=old_x[0]-20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
if (*direction == 4) {
|
||||
pos_x[0]=old_x[0]+20;
|
||||
ChargerImage("../img/PAUSE.png", pos_x[0], pos_y[0], 0,0,20,20);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void dessinerSerpent(int pos_x[], int pos_y[], int segment, int old_x[], int old_y[]){
|
||||
int i;
|
||||
for (i=0 ; i<segment ; i++){
|
||||
ChargerImage("../img/serpent2.png", pos_x[i], pos_y[i],0,0, 20,20);
|
||||
ChargerImage("../img/serpent2.png", old_x[i], old_y[i],0,0, 20,20);
|
||||
}
|
||||
for (i=0 ; i<segment ; i++){
|
||||
ChoisirCouleurDessin(CouleurParComposante(218,209,77));
|
||||
RemplirRectangle(pos_x[segment-1], pos_y[segment-1], 20,20);
|
||||
RemplirRectangle(old_x[segment-1], old_y[segment-1], 20,20);
|
||||
|
||||
old_x[i]=pos_x[i];
|
||||
old_y[i]=pos_y[i];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mury[], int *go_on){
|
||||
int i;
|
||||
/*Serpent contre coté*/
|
||||
if (pos_x[0] >1180 || pos_x[0]<=0){
|
||||
if (pos_x[0] >1160 || pos_x[0]<=0){
|
||||
*go_on=0;
|
||||
}
|
||||
/*Serpent contre coté*/
|
||||
@@ -55,6 +62,7 @@ void Collision_Serpent(int pos_x[], int pos_y[], int segment, int murx[], int mu
|
||||
*go_on=0;
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void Controle(int *direction, int last_direction, int *go_on, int *pause) {
|
||||
|
Reference in New Issue
Block a user