-
Notifications
You must be signed in to change notification settings - Fork 0
/
affich.c
87 lines (61 loc) · 1.85 KB
/
affich.c
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
// affich.c
// pacmanc
//
// Worked by Elyes & RK on 21/06/2016.
// Copyright © 2016 Elyes. All rights reserved.
//
#include <windows.h>
#include "affich.h"
#include "motifs.h"
#include "setwindow.h"
#include <conio.h> //librairie
//Ref: http://code-reference.com/c/conio.h/textcolor
void affich(char map[20][38], int score, int bonus, int frame, int vies){
/*NOTE : Map prend 20 de hauteur et 38 de largeur*/
int i, j;
system("CLS");//Clean
textcolor(15);
printf("Deplacez le pacman a l'aide des touches z(haut), q(gauche), s(bas) et d(droite).\nTentez d'attraper les %c pour gober les fantômes BOUHHH chance\nQuittez avec Echap\n", point);
for(i=0; i<20; i++)
{
for(j=0; j<38; j++)
{
if(map[i][j] == 'C')//On colorie le pacman en jaune
{
textcolor(14);
}
else if(map[i][j] == 'M') //M désigne les monstres colorié en rouge
{
textcolor(12);
if(bonus && (frame<35 || frame%3))
{
textcolor(10);
}
}
else if(map[i][j] == '.')//Les points sont symbolisés par la couleur blanche
{
textcolor(15);
}
else if(map[i][j] == point)
{
textcolor(10);
}
else
{
textcolor(9);
}
printf("%c", map[i][j]); //On affiche le terrain
}
textcolor(14);
if(i==10){printf(" score : %d", score);}; //Points++
if(i==12){printf(" vies : %d", vies);}; //Monstre = -1 Vie
printf("\n");
}
textcolor(10);
if(bonus) //Compte a rebours pour le bonus
{
printf("========== BONUS ACTIVE %d ==========", 50 - frame);
}
textcolor(15);
Sleep(200);
}