jf8441 commited on
Commit
0ef7a64
1 Parent(s): 8a362e7

Upload 25 files

Browse files
Files changed (25) hide show
  1. AnotherGhost.cpp +52 -0
  2. FileIO.cpp +80 -0
  3. FileIO.h +33 -0
  4. Fruit.cpp +77 -0
  5. Fruit.h +31 -0
  6. Game.cpp +150 -0
  7. Game.h +53 -0
  8. Ghost.cpp +333 -0
  9. Ghost.h +56 -0
  10. Maze.cpp +108 -0
  11. Maze.h +38 -0
  12. Pacman.cpp +235 -0
  13. Pacman.h +40 -0
  14. Pacman_Game_Save.txt +18 -0
  15. Size.cpp +21 -0
  16. Size.h +31 -0
  17. Utilities.cpp +70 -0
  18. Utilities.h +43 -0
  19. main.cpp +135 -0
  20. map1.txt +18 -0
  21. map2.txt +18 -0
  22. map3.txt +18 -0
  23. pacman.vcxproj +100 -0
  24. pacman.vcxproj.filters +72 -0
  25. pacman.vcxproj.user +3 -0
AnotherGhost.cpp ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <iostream>
2
+ using namespace std;
3
+ #include <fstream>
4
+ #include <string>
5
+ #include "Utilities.h"
6
+ #include "Game.h"
7
+ #include "Ghost.h"
8
+ #include "Maze.h"
9
+ #include "Pacman.h"
10
+ #include "AnotherGhost.h"
11
+ #include "Node.h"
12
+ #include "Edge.h"
13
+ #include "Dijkstra.h"
14
+ #include <climits>
15
+ #include <ctime>
16
+ /*
17
+ AnotherGhost::AnotherGhost(){
18
+ ax = 1;
19
+ ay = 1;
20
+ direction = 5;
21
+ d = 0;
22
+ g = "A";
23
+ OrgX = 0;
24
+ OrgY = 0;
25
+ limit = 0;
26
+ speed = 0;
27
+ reduceLimit = 1;
28
+ }
29
+ AnotherGhost::AnotherGhost(int x, int y, string GhostG)
30
+ {
31
+ ax = x;
32
+ ay = y;
33
+ direction = 5;
34
+ d = 0;
35
+ g = GhostG;
36
+ OrgX = x;
37
+ OrgY = y;
38
+ limit = 0;
39
+ speed = 0;
40
+ reduceLimit = 0;
41
+ }
42
+
43
+
44
+ void AnotherGhost::increaseSpeed(int &dot){
45
+ if(dot>20){
46
+ if(limit != 50){
47
+ limit = 150 - 50;//10 * reduceLimit;
48
+ reduceLimit++;
49
+ }
50
+ }
51
+ }
52
+ */
FileIO.cpp ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ /*
3
+ Name:Wong Pui Shan
4
+ Sdutent ID:52611804
5
+ program: AScISD
6
+ Name: HAR Chiu Kwong Samson
7
+ Sdutent ID:52629360
8
+ program: AScISD
9
+ Name: LAM Cheuk Man
10
+ Sdutent ID:52621140
11
+ program: AScISD
12
+ Name:KO Jeffrey KO
13
+ Sdutent ID:525 695 30
14
+ program: AScISD
15
+
16
+ */
17
+ #include <iostream>
18
+ #include <fstream>
19
+ #include "FileIO.h"
20
+ #include "Maze.h"
21
+ #include "Utilities.h"
22
+ #include "Game.h"
23
+ using namespace std;
24
+
25
+ // fuction for out the Current Game State to txt file
26
+ void FileIO::SaveGame (Maze &m, Utilities &u, Game &g)
27
+ {
28
+ quitAfterSave = false;
29
+ //Eneter the funtion When User press 'p' key
30
+ if (u.checkKey()=='p')
31
+ {
32
+ // for later user's input checking
33
+ int saveChoice = 0;
34
+
35
+ ofstream fout;
36
+ fout.open ("Pacman_Game_Save.txt");
37
+
38
+ //store the current maze state in the txt folder
39
+ for (int i=0;i<18;i++)
40
+ {
41
+ for (int j=0;j<21;j++)
42
+ {
43
+ fout << m.getMazeArray(j,i);
44
+ }
45
+ fout << endl;
46
+ }
47
+
48
+ fout.close();
49
+
50
+ // Print Chooses for Continue Game or not
51
+ do{
52
+ u.gotoXY(0,20);
53
+ cout <<" ";
54
+ u.gotoXY(0,20);
55
+ cout << "Your game has been saved, 1: Contiue 2: Quit: " << endl;
56
+ cout << " ";
57
+ u.gotoXY(45,20);
58
+ cin >> saveChoice;
59
+ }while(saveChoice!=1 && saveChoice!=2); // Loop while user not input 1 or 2
60
+
61
+ // Setting for end game
62
+ if (saveChoice == 2)
63
+ {
64
+ g.setLoopGameBool(false);
65
+ quitAfterSave =true;
66
+ }
67
+
68
+ else
69
+ // Cover the printed word
70
+ {
71
+ u.gotoXY(0,20);
72
+ cout <<" ";
73
+ }
74
+ }
75
+ }
76
+
77
+ bool FileIO::getQuitAfterSave()
78
+ {
79
+ return quitAfterSave;
80
+ }
FileIO.h ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef FILEIO_H
17
+ #define FILEIO_H
18
+
19
+ #include "Maze.h"
20
+ #include "Utilities.h"
21
+ #include "Game.h"
22
+
23
+ class FileIO
24
+ {
25
+ private:
26
+ bool quitAfterSave;
27
+ public:
28
+ void SaveGame (Maze &m, Utilities &u, Game &g);
29
+ bool getQuitAfterSave();
30
+ };
31
+
32
+
33
+ #endif
Fruit.cpp ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #include <iostream>
17
+ using namespace std;
18
+ #include <fstream>
19
+ #include <string>
20
+ #include "Utilities.h"
21
+ #include "Game.h"
22
+ #include "Ghost.h"
23
+ #include "Maze.h"
24
+ #include "Pacman.h"
25
+ #include "Fruit.h"
26
+
27
+
28
+ Fruit::Fruit(){
29
+ fx = 1;
30
+ fy = 1;
31
+ charF = '!';
32
+ number = 1;
33
+ levelFruit = 1;
34
+
35
+ }
36
+ Fruit::Fruit(char fruit){
37
+ charF = fruit;
38
+ fx = 1;
39
+ fy = 1;
40
+ number = 1;
41
+ levelFruit = 1;
42
+ }
43
+
44
+ void Fruit::showFruit(Game &game, int &dot, Maze &m, Utilities &f){
45
+ //Set the fruit randomly on the map when pacman eat 70 dots
46
+ levelFruit = game.getGameLevel();
47
+ if(dot == 70)
48
+ {
49
+ do{
50
+ fx = rand() % 21 ;
51
+ fy = rand() % 18 ;
52
+ dot = 0;
53
+ }while(m.getMazeArray(fx, fy)=='-' || m.getMazeArray(fx, fy)=='|' || m.getMazeArray(fx, fy)=='.' || m.getMazeArray(fx, fy)=='X');
54
+ f.gotoXY(fx,fy);
55
+ f.changeColour(FOREGROUND_GREEN | FOREGROUND_BLUE);
56
+ switch(levelFruit){
57
+ case 1:
58
+ charF = '!';
59
+
60
+ break;
61
+ case 2:
62
+ charF = '*';
63
+
64
+ break;
65
+ case 3:
66
+ charF = '#';
67
+
68
+ break;
69
+ }
70
+ cout << charF;
71
+ m.setMazeArray(fx,fy,charF);
72
+
73
+ }
74
+ }
75
+
76
+ Fruit::~Fruit(){
77
+ }
Fruit.h ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef FRUIT_H
17
+ #define FRUIT_H
18
+ class Fruit{
19
+ private:
20
+ int fx;
21
+ int fy;
22
+ char charF;
23
+ int number;
24
+ int levelFruit;
25
+ public:
26
+ Fruit();
27
+ Fruit(char fruit);
28
+ ~Fruit();
29
+ void Fruit::showFruit(Game &game, int &dot, Maze &m, Utilities &f);
30
+ };
31
+ #endif
Game.cpp ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #include "Game.h"
17
+ #include "Maze.h"
18
+ #include "Utilities.h"
19
+ #include<iostream>
20
+ using namespace std;
21
+
22
+ Game::Game()
23
+ {
24
+ level = 1;
25
+ life = 3;
26
+ point = 0;
27
+ loopGame = true;
28
+ addLife = 0;
29
+ }
30
+
31
+ void Game::setPoint(int x)
32
+ {
33
+ point += x;
34
+ }
35
+ void Game::print1()
36
+ {
37
+ //show the level and Game Point
38
+ // Extra Life when user meet more than 8888 points
39
+ cout << "Level: " << level << "\tGP:" << point << endl;
40
+ bool check = false;
41
+ if(point > 8888 && addLife==0 )
42
+ {
43
+ check = true;
44
+ while(check)
45
+ {
46
+ extraLife();
47
+ check = false;
48
+ addLife++;
49
+ }
50
+ }
51
+
52
+ }
53
+
54
+ void Game::print2()
55
+ {
56
+ cout << "Life left: " << life << " ";
57
+
58
+ switch(level){
59
+ case 1:
60
+ cout << "Fruit:Cherry " << endl;
61
+ break;
62
+ case 2:
63
+ cout << "Fruit:Strayberry " << endl;
64
+ break;
65
+ case 3:
66
+ cout << "Fruit:Orange " << endl;
67
+ break;
68
+ }
69
+ }
70
+
71
+ int Game::getPoint()
72
+ {
73
+ return point;
74
+ }
75
+
76
+ void Game::Move(Maze m,Utilities u)
77
+ {
78
+ u.gotoXY(0,18);
79
+ u.changeColour(FOREGROUND_WHITE);
80
+ Game::print1();
81
+ Game::print2();
82
+ u.gotoXY(0,20);
83
+ cout << " ";
84
+ u.gotoXY(0,20);
85
+ cout << "Remain Dot: "<< m.getTotalDot() << endl;
86
+ cout << "Press p to pause";
87
+ u.changeColour(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
88
+ }
89
+
90
+ int Game::GetLife(){
91
+ return life;
92
+ }
93
+
94
+ void Game::setLife()
95
+ {
96
+ life = 3;
97
+ }
98
+
99
+ void Game::extraLife()
100
+ {
101
+ life++;
102
+ }
103
+
104
+ bool Game::getLoopGameBool()
105
+ {
106
+ return loopGame;
107
+ }
108
+
109
+ void Game::setLoopGameBool(bool temp)
110
+ {
111
+ loopGame = temp;
112
+ }
113
+
114
+ void Game::checkForUpLevel(Maze &m)
115
+ {
116
+ if (m.getTotalDot()==0)
117
+ {
118
+ setGameLevel();
119
+ setLoopGameBool(false);
120
+ }
121
+ }
122
+
123
+
124
+ void Game::setGameLevel()
125
+ {
126
+ level++;
127
+ }
128
+
129
+ int Game::getGameLevel()
130
+ {
131
+ return level;
132
+ }
133
+
134
+ void Game:: setReplayBool(bool temp)
135
+ {
136
+ replay = temp;
137
+ }
138
+
139
+ bool Game::getReplayBool()
140
+ {
141
+ return replay;
142
+ }
143
+
144
+ void Game::gameReset()
145
+ {
146
+ level = 1;
147
+ life = 3;
148
+ point = 0;
149
+ loopGame = true;
150
+ }
Game.h ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef GAME_H
17
+ #define GAME_H
18
+
19
+ #include<iostream>
20
+ #include "Utilities.h"
21
+ #include "Maze.h"
22
+ using namespace std;
23
+ class Game
24
+ {
25
+ private:
26
+ int level;
27
+ int life;
28
+ int point;
29
+ int addLife;
30
+ bool loopGame;
31
+ bool replay;
32
+
33
+ public:
34
+ Game();
35
+ void setPoint(int x);
36
+ int getPoint();
37
+ void print1();
38
+ void print2();
39
+ void Move(Maze m,Utilities u);
40
+ friend class Ghost;
41
+ int GetLife();
42
+ void setLife();
43
+ void extraLife();
44
+ bool getLoopGameBool();
45
+ void setLoopGameBool(bool temp);
46
+ void checkForUpLevel(Maze &m);
47
+ void setGameLevel();
48
+ int getGameLevel();
49
+ void setReplayBool(bool temp);
50
+ bool getReplayBool();
51
+ void gameReset();
52
+ };
53
+ #endif
Ghost.cpp ADDED
@@ -0,0 +1,333 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #include <iostream>
17
+ #include <fstream>
18
+ #include <string>
19
+ #include "Utilities.h"
20
+ #include "Game.h"
21
+ #include "Ghost.h"
22
+ #include "Pacman.h"
23
+ #include "Maze.h"
24
+ #include <climits>
25
+ #include <ctime>
26
+ using namespace std;
27
+ Ghost::Ghost(){
28
+ ax = 1;
29
+ ay = 1;
30
+ direction = 5;
31
+ d = 0;
32
+ g = "A";
33
+ OrgX = 0;
34
+ OrgY = 0;
35
+ limit = 0;
36
+ speed = 0;
37
+ reduceLimit = 100;
38
+ }
39
+
40
+ Ghost::Ghost(int x, int y, string GhostG)
41
+ {
42
+ ax = x;
43
+ ay = y;
44
+ direction = 5;
45
+ d = 0;
46
+ g = GhostG;
47
+ OrgX = x;
48
+ OrgY = y;
49
+ limit = 0;
50
+ reduceLimit = 100;
51
+ }
52
+ void Ghost::increaseSpeed(int &dot){
53
+ if(limit >60){
54
+ if(dot == 20)
55
+ reduceLimit = 80;
56
+ if(dot == 40)
57
+ reduceLimit = 90;
58
+ if(dot == 60)
59
+ reduceLimit = 70;
60
+ }
61
+ }
62
+ void Ghost::ChangePosition()
63
+ {
64
+ if(g == "A")
65
+ g = "a";
66
+ else if(g == "B")
67
+ g = "b";
68
+ else if(g == "C")
69
+ g = "c";
70
+ else if(g == "D")
71
+ g = "d";
72
+
73
+ }
74
+
75
+ void Ghost::showGhost(Utilities a)
76
+ {
77
+ //Set up the color of the ghosts.
78
+ a.gotoXY(ax, ay);
79
+ if (g == "A")
80
+ a.changeColour(FOREGROUND_RED);
81
+ if (g == "B")
82
+ a.changeColour(0x000d);
83
+ if (g == "C")
84
+ a.changeColour(FOREGROUND_GREEN);
85
+ if (g == "D")
86
+ a.changeColour(FOREGROUND_BLUE | FOREGROUND_INTENSITY);
87
+ if (g == "a" || g == "b" || g == "c" || g == "d")
88
+ a.changeColour(BACKGROUND_WHITE | FOREGROUND_BLUE | FOREGROUND_INTENSITY);
89
+ cout << g;
90
+ }
91
+
92
+ void Ghost::Move(Maze &m, Utilities a)
93
+ {
94
+ //Set up the speed of the ghost
95
+ if (limit > 0)
96
+ {
97
+ --limit;
98
+ return;
99
+ }
100
+ limit = reduceLimit;
101
+ //Avoid the ghost to eat the dot, power dot and the fruit on the map
102
+ a.gotoXY(ax,ay);
103
+ a.changeColour(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
104
+ if (m.getMazeArray(ax, ay)=='X')
105
+ {
106
+ m.setMazeArray(ax, ay,'X');
107
+ cout << "X";
108
+ }
109
+ else if (m.getMazeArray(ax, ay)=='.')
110
+ {
111
+ m.setMazeArray(ax, ay,'.');
112
+ cout << ".";
113
+ }
114
+ else if (m.getMazeArray(ax, ay)==' ')
115
+ {
116
+ m.setMazeArray(ax, ay,' ');
117
+ cout << " ";
118
+ }
119
+ a.gotoXY(ax,ay);
120
+ a.changeColour(FOREGROUND_GREEN | FOREGROUND_BLUE);
121
+ if (m.getMazeArray(ax, ay)=='!')
122
+ {
123
+ m.setMazeArray(ax, ay,'!');
124
+ cout << "!";
125
+ }
126
+ else if (m.getMazeArray(ax, ay)=='*')
127
+ {
128
+ m.setMazeArray(ax, ay,'*');
129
+ cout << "*";
130
+ }
131
+ else if (m.getMazeArray(ax, ay)=='#')
132
+ {
133
+ m.setMazeArray(ax, ay,'#');
134
+ cout << "#";
135
+ }
136
+
137
+
138
+ do{
139
+ // loop for granerate ghost's direction
140
+ do{
141
+ d = rand() % 4 + 1;
142
+ if (m.getMazeArray(ax, ay-1)!='-' && m.getMazeArray(ax, ay-1)!='|' && d == 1)
143
+ break;
144
+ else if (m.getMazeArray(ax, ay+1)!='-' && m.getMazeArray(ax, ay+1)!='|'&& d == 4)
145
+ break;
146
+ else if (m.getMazeArray(ax-1, ay)!='-' && m.getMazeArray(ax-1, ay)!='|'&& d == 2)
147
+ break;
148
+ else if (m.getMazeArray(ax+1, ay)!='-' && m.getMazeArray(ax+1, ay)!='|'&& d == 3)
149
+ break;
150
+ }while (true);
151
+ }while (d == 5 - direction ||
152
+ (d == 4 && (ax==8 && ay==5))||
153
+ (d == 4 && (ax==9 && ay==5))||
154
+ (d == 4 && (ax==10 && ay==5))|| //It is used for avoid go oppostie direction and go to ghost home
155
+ (d == 4 && (ax==11 && ay==5))||
156
+ (d == 4 && (ax==12 && ay==5)));
157
+
158
+ //change the diection
159
+
160
+ switch(d){
161
+ case 1:
162
+ ay--;
163
+ direction = 1;
164
+ break;
165
+
166
+ case 4: // Down arrow
167
+ ay++;
168
+ direction = 4;
169
+ break;
170
+
171
+ case 2: // Left arrow
172
+ ax--;
173
+ direction = 2;
174
+ break;
175
+
176
+ case 3: // Right arrow
177
+ ax++;
178
+ direction = 3;
179
+ break;
180
+ }
181
+ a.gotoXY(ax,ay);
182
+ cout << g;
183
+
184
+
185
+ }
186
+ //if the pacman eat the power dot, the status od the ghost change.
187
+ void Ghost::slowMove(Maze &m, Utilities a)
188
+ {
189
+ //reduce the speed of the ghosts
190
+ if (speed > 0)
191
+ {
192
+ --speed;
193
+ return;
194
+ }
195
+ speed = 200;
196
+
197
+ //set up the color of the ghosts
198
+ a.gotoXY(ax,ay);
199
+ a.changeColour(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
200
+ if (m.getMazeArray(ax, ay)=='X')
201
+ {
202
+ m.setMazeArray(ax, ay,'X');
203
+ cout << "X";
204
+ }
205
+ else if (m.getMazeArray(ax, ay)=='.')
206
+ {
207
+ m.setMazeArray(ax, ay,'.');
208
+ cout << ".";
209
+ }
210
+ else if (m.getMazeArray(ax, ay)==' ')
211
+ {
212
+ m.setMazeArray(ax, ay,' ');
213
+ cout << " ";
214
+ }
215
+
216
+ else if (m.getMazeArray(ax, ay)=='!')
217
+ {
218
+ m.setMazeArray(ax, ay,'!');
219
+ cout << "!";
220
+ }
221
+ else if (m.getMazeArray(ax, ay)=='*')
222
+ {
223
+ m.setMazeArray(ax, ay,'*');
224
+ cout << "*";
225
+ }
226
+ else if (m.getMazeArray(ax, ay)=='#')
227
+ {
228
+ m.setMazeArray(ax, ay,'#');
229
+ cout << "#";
230
+ }
231
+
232
+
233
+ do{
234
+ // loop for granerate ghost's direction
235
+ do{
236
+ d = rand() % 4 + 1;
237
+ if (m.getMazeArray(ax, ay-1)!='-' && m.getMazeArray(ax, ay-1)!='|' && d == 1)
238
+ break;
239
+ else if (m.getMazeArray(ax, ay+1)!='-' && m.getMazeArray(ax, ay+1)!='|'&& d == 4)
240
+ break;
241
+ else if (m.getMazeArray(ax-1, ay)!='-' && m.getMazeArray(ax-1, ay)!='|'&& d == 2)
242
+ break;
243
+ else if (m.getMazeArray(ax+1, ay)!='-' && m.getMazeArray(ax+1, ay)!='|'&& d == 3)
244
+ break;
245
+ }while (true);
246
+ }while (d == 5 - direction ||
247
+ (d == 4 && (ax==8 && ay==5))||
248
+ (d == 4 && (ax==9 && ay==5))||
249
+ (d == 4 && (ax==10 && ay==5))|| //It is used for avoid go oppostie direction and go to ghost home
250
+ (d == 4 && (ax==11 && ay==5))||
251
+ (d == 4 && (ax==12 && ay==5)));
252
+
253
+ //change the diection
254
+
255
+ switch(d){
256
+ case 1:
257
+ ay--;
258
+ direction = 1;
259
+ break;
260
+
261
+ case 4: // Down arrow
262
+ ay++;
263
+ direction = 4;
264
+ break;
265
+
266
+ case 2: // Left arrow
267
+ ax--;
268
+ direction = 2;
269
+ break;
270
+
271
+ case 3: // Right arrow
272
+ ax++;
273
+ direction = 3;
274
+ break;
275
+ }
276
+ a.gotoXY(ax,ay);
277
+ cout << g;
278
+
279
+
280
+ }
281
+
282
+
283
+ void Ghost::EatPacman(Pacman &p, Game &g, Utilities &a,Utilities &u,Utilities &j, Utilities &k, Utilities &l, Ghost &o, Ghost &m, Ghost &n)
284
+ {
285
+ //if ghost met pacman, pacman life reduce and the location of ghosts and Pacman reset
286
+ if (ax == p.getPacmanX() && ay == p.getPacmanY())
287
+ {
288
+ g.life--;
289
+ Ghost::ResetGhost(a);
290
+ n.ResetGhost(j);
291
+ m.ResetGhost(k);
292
+ o.ResetGhost(l);
293
+ p.Die(u);
294
+ }
295
+ }
296
+
297
+ void Ghost::ResetGhost(Utilities &a){
298
+ a.gotoXY(ax, ay);
299
+ a.changeColour(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
300
+ cout << " ";
301
+ Ghost::ResetLocation();
302
+ a.gotoXY(ax, ay);
303
+ a.changeColour(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
304
+ cout << g;
305
+ }
306
+ void Ghost::ResetLocation(){
307
+ //save the original location of ghost
308
+ ax = OrgX;
309
+ ay = OrgY;
310
+ }
311
+ void Ghost::RechangePosition(){
312
+ //change the status of ghost to nomal
313
+ if(g == "a")
314
+ g = "A";
315
+ else if(g == "b")
316
+ g = "B";
317
+ else if(g == "c")
318
+ g = "C";
319
+ else if(g == "d")
320
+ g = "D";
321
+ }
322
+ int Ghost::GetGhostX(){
323
+ return ax;
324
+ }
325
+ int Ghost::GetGhostY(){
326
+ return ay;
327
+ }
328
+ string Ghost::GetGhostMember(){
329
+ return g;
330
+ }
331
+ Ghost::~Ghost(){
332
+
333
+ }
Ghost.h ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef GHOST_H
17
+ #define GHOST_H
18
+ #include "Ghost.h"
19
+ #include "Utilities.h"
20
+ #include "Maze.h"
21
+ #include "Pacman.h"
22
+ #include "Game.h"
23
+ #include <iostream>
24
+ #include <climits>
25
+ #include <ctime>
26
+ using namespace std;
27
+ class Ghost{
28
+ private:
29
+ int ax;
30
+ int ay;
31
+ int direction;
32
+ int d;
33
+ string g;
34
+ int OrgX;
35
+ int OrgY;
36
+ int limit;
37
+ int speed;
38
+ int reduceLimit;
39
+ public:
40
+ Ghost();
41
+ Ghost(int ax, int ay, string GhostG);
42
+ void increaseSpeed(int &dot);
43
+ ~Ghost();
44
+ void ChangePosition();
45
+ void Ghost::showGhost(Utilities a);
46
+ void Move(Maze &m, Utilities a);
47
+ void slowMove(Maze &m, Utilities a);
48
+ void EatPacman(Pacman &p, Game &g, Utilities &a, Utilities &u,Utilities &j, Utilities &k, Utilities &l, Ghost &o, Ghost &m, Ghost &n);
49
+ void ResetGhost(Utilities &a);
50
+ void ResetLocation();
51
+ void RechangePosition();
52
+ int GetGhostX();
53
+ int GetGhostY();
54
+ string GetGhostMember();
55
+ };
56
+ #endif
Maze.cpp ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #include <fstream>
17
+ #include <string>
18
+ #include<iostream>
19
+ #include "Maze.h"
20
+ using namespace std;
21
+
22
+
23
+ void Maze::printMaze(int gameLevel)
24
+ {
25
+ ifstream inFile;
26
+ switch (gameLevel)
27
+ {
28
+ case 1:
29
+ inFile.open("map1.txt"); // open the file
30
+ break;
31
+ case 2:
32
+ inFile.open("map2.txt"); // open the file
33
+ break;
34
+ case 3:
35
+ inFile.open("map3.txt"); // open the file
36
+ break;
37
+ }
38
+
39
+ int i = 0;
40
+ totalDot = 0;
41
+ str = new string[18];
42
+ if(inFile.is_open()) // check if the file could be open
43
+ {
44
+ while(!inFile.eof()) // not end of file
45
+ {
46
+ getline(inFile, str[i]); // obtain a line of text from file
47
+ for(int a=0;a<21;a++)
48
+ {
49
+ cout << str[i][a];
50
+ }
51
+ cout << endl;
52
+ i++;
53
+ }
54
+ inFile.close(); // close the file
55
+ }
56
+ else
57
+ cout << "Fail to open file" << endl;
58
+ }
59
+
60
+ char Maze::getMazeArray(int x, int y) const
61
+ {
62
+ char temp = str[y][x];
63
+ return temp;
64
+ }
65
+
66
+ void Maze::setMazeArray(int x, int y, char symbol)
67
+ {
68
+ str[y][x] = symbol;
69
+ }
70
+
71
+ void Maze::killArray()
72
+ {
73
+ delete []str;
74
+ }
75
+
76
+
77
+ int Maze::getTotalDot()
78
+ {
79
+ return totalDot;
80
+ }
81
+
82
+
83
+ void Maze::setTotalDot(int n)
84
+ {
85
+ totalDot += n ;
86
+ }
87
+
88
+ void Maze::checkTotalDot()
89
+ {
90
+ //count the total amount of Dot in the Maze
91
+ totalDot=0;
92
+ for(int i=0; i<18;i++)
93
+ {
94
+ for (int j=0; j<21; j++)
95
+ {
96
+ if (getMazeArray(j,i)=='.' || getMazeArray(j,i)=='X')
97
+ {
98
+ totalDot++;
99
+ }
100
+ }
101
+ }
102
+ }
103
+
104
+ void Maze::mazeReset(int gameLevel)
105
+ {
106
+ printMaze(gameLevel);
107
+ }
108
+
Maze.h ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef MAZE_H
17
+ #define MAZE_H
18
+
19
+ #include<iostream>
20
+ #include <string>
21
+ using namespace std;
22
+
23
+ class Maze
24
+ {
25
+ private:
26
+ string* str;
27
+ int totalDot;
28
+ public:
29
+ void printMaze(int gameLevel);
30
+ char Maze::getMazeArray(int x, int y) const;
31
+ void Maze::setMazeArray(int x, int y, char symbol);
32
+ void Maze::killArray();
33
+ int getTotalDot();
34
+ void setTotalDot(int n);
35
+ void checkTotalDot();
36
+ void mazeReset(int gameLevel);
37
+ };
38
+ #endif
Pacman.cpp ADDED
@@ -0,0 +1,235 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #include <iostream>
17
+ #include <fstream>
18
+ #include <string>
19
+ #include "Utilities.h"
20
+ #include "Game.h"
21
+ #include "Ghost.h"
22
+ #include "Pacman.h"
23
+ #include "Maze.h"
24
+ #include "FileIO.h"
25
+ #include "FileIO.h"
26
+ #include "Fruit.h"
27
+ #include <climits>
28
+ #include <ctime>
29
+ using namespace std;
30
+ Pacman::Pacman(){
31
+ c = 'c';
32
+ x = 10;
33
+ y = 9;
34
+ Ox = 10;
35
+ Oy = 9;
36
+ }
37
+
38
+ int Pacman::getPacmanX()
39
+ {
40
+ return x;
41
+ }
42
+
43
+ int Pacman::getPacmanY()
44
+ {
45
+ return y;
46
+ }
47
+
48
+ void Pacman::Move(Game &g, Maze &m,Utilities u, int &dot, Ghost &ga, Ghost &gb, Ghost &gc, Ghost &gd, Utilities &ud,Utilities &uc,Utilities &ub,Utilities &ua,Utilities &z, Fruit &fruit1, Utilities &f)
49
+ {
50
+ FileIO fileIO;
51
+ u.gotoXY(x,y);
52
+ u.changeColour(FOREGROUND_YELLOW );
53
+ cout << "p";
54
+ c = u.checkKey();
55
+ u.gotoXY(x,y);
56
+ cout << " ";
57
+ switch (c)
58
+ {
59
+ case 72: // Up arrow
60
+ if (m.getMazeArray(x, y-1)!='-' && m.getMazeArray(x, y-1)!='|')
61
+ y--;
62
+ break;
63
+ case 80: // Down arrow
64
+ if (m.getMazeArray(x, y+1)!='-' && m.getMazeArray(x, y+1)!='|')
65
+ y++;
66
+ break;
67
+ case 75: // Left arrow
68
+ if (m.getMazeArray(x-1, y)!='-' && m.getMazeArray(x-1, y)!='|')
69
+ x--;
70
+ break;
71
+ case 77: // Right arrow
72
+ if (m.getMazeArray(x+1, y)!='-' && m.getMazeArray(x+1, y)!='|')
73
+ x++;
74
+ break;
75
+ }
76
+ // Move cursor to updated position
77
+ unsigned int start = time(NULL);
78
+ u.gotoXY(x,y);
79
+ cout << "p";
80
+ if (m.getMazeArray(x, y)=='X')
81
+ {
82
+ m.setTotalDot(-1);
83
+ m.setMazeArray(x, y,' ');
84
+ g.setPoint(50);
85
+ //loop the situstion that pacman eat the power dot
86
+ while(time(NULL) - start < 10 && g.getLoopGameBool() == true)
87
+ {
88
+ //_sleep(80);
89
+ fileIO.SaveGame (m, u, g);
90
+ Pacman::OppositePosition(g, m, u, dot);
91
+ ga.ChangePosition();
92
+ gb.ChangePosition();
93
+ gc.ChangePosition();
94
+ gd.ChangePosition();
95
+ ga.showGhost(ua);
96
+ ga.slowMove(m, ua);
97
+ gb.showGhost(ub);
98
+ gb.slowMove(m, ub);
99
+ gc.showGhost(uc);
100
+ gc.slowMove(m, uc);
101
+ gd.showGhost(ud);
102
+ gd.slowMove(m, ud);
103
+ g.Move(m, z);
104
+ g.checkForUpLevel(m);
105
+ Pacman::EatingGhost(ga, g, ua, u);
106
+ Pacman::EatingGhost(gb, g, ub, u);
107
+ Pacman::EatingGhost(gc, g, uc, u);
108
+ Pacman::EatingGhost(gd, g, ud, u);
109
+ fruit1.showFruit(g, dot, m, f);
110
+ }
111
+ ga.RechangePosition();
112
+ gb.RechangePosition();
113
+ gc.RechangePosition();
114
+ gd.RechangePosition();
115
+ }
116
+ //Pacman eat the dots, power dot, and fruit and add the point
117
+ else if (m.getMazeArray(x, y)=='.')
118
+ {
119
+ m.setTotalDot(-1);
120
+ m.setMazeArray(x, y,' ');
121
+ g.setPoint(10);
122
+ dot ++;
123
+ }
124
+ else if (m.getMazeArray(x, y)=='!')
125
+ {
126
+ m.setMazeArray(x, y,' ');
127
+ g.setPoint(100);
128
+ }
129
+ else if (m.getMazeArray(x, y)=='*')
130
+ {
131
+ m.setMazeArray(x, y,' ');
132
+ g.setPoint(300);
133
+ }
134
+ else if (m.getMazeArray(x, y)=='#')
135
+ {
136
+ m.setMazeArray(x, y,' ');
137
+ g.setPoint(500);
138
+ }
139
+
140
+ }
141
+
142
+ void Pacman::Die(Utilities &u)
143
+ {
144
+ //reset the pacman when it is eaten
145
+ x = Ox;
146
+ y = Oy;
147
+ u.gotoXY(Ox,Oy);
148
+ u.changeColour(FOREGROUND_YELLOW);
149
+ cout << "p";
150
+
151
+ }
152
+
153
+
154
+ //For the status of eat power dot pacman
155
+ void Pacman::OppositePosition(Game &g, Maze &m,Utilities u, int &dot)
156
+ {
157
+ u.gotoXY(x,y);
158
+ u.changeColour(FOREGROUND_YELLOW);
159
+ cout << "P";
160
+ c = u.checkKey();
161
+ u.gotoXY(x,y);
162
+ cout << " ";
163
+ switch (c)
164
+ {
165
+ case 72: // Up arrow
166
+ if (m.getMazeArray(x, y-1)!='-' && m.getMazeArray(x, y-1)!='|')
167
+ y--;
168
+ break;
169
+ case 80: // Down arrow
170
+ if (m.getMazeArray(x, y+1)!='-' && m.getMazeArray(x, y+1)!='|')
171
+ y++;
172
+ break;
173
+ case 75: // Left arrow
174
+ if (m.getMazeArray(x-1, y)!='-' && m.getMazeArray(x-1, y)!='|')
175
+ x--;
176
+ break;
177
+ case 77: // Right arrow
178
+ if (m.getMazeArray(x+1, y)!='-' && m.getMazeArray(x+1, y)!='|')
179
+ x++;
180
+ break;
181
+ }
182
+ // Move cursor to updated position
183
+ u.gotoXY(x,y);
184
+ cout << "P";
185
+ if (m.getMazeArray(x, y)=='X')
186
+ {
187
+ m.setTotalDot(-1);
188
+ m.setMazeArray(x, y,' ');
189
+ g.setPoint(50);
190
+
191
+ }
192
+ else if (m.getMazeArray(x, y)=='.')
193
+ {
194
+ m.setTotalDot(-1);
195
+ m.setMazeArray(x, y,' ');
196
+ g.setPoint(10);
197
+ dot ++;
198
+ }
199
+ else if (m.getMazeArray(x, y)=='!')
200
+ {
201
+ m.setMazeArray(x, y,' ');
202
+ g.setPoint(100);
203
+ }
204
+ else if (m.getMazeArray(x, y)=='*')
205
+ {
206
+ m.setMazeArray(x, y,' ');
207
+ g.setPoint(300);
208
+ }
209
+ else if (m.getMazeArray(x, y)=='#')
210
+ {
211
+ m.setMazeArray(x, y,' ');
212
+ g.setPoint(500);
213
+ }
214
+ }
215
+
216
+
217
+
218
+ void Pacman::EatingGhost(Ghost &ghost, Game &g, Utilities &a, Utilities &u)
219
+ {
220
+ //pacman eat the ghost and add point
221
+ string charGhost = ghost.GetGhostMember();
222
+ if (ghost.GetGhostX() == x && ghost.GetGhostY() == y)
223
+ {
224
+ if(charGhost == "a")
225
+ g.setPoint(800);
226
+ else if(charGhost == "b")
227
+ g.setPoint(400);
228
+ else if(charGhost == "c")
229
+ g.setPoint(200);
230
+ else if(charGhost == "d")
231
+ g.setPoint(100);
232
+ ghost.ResetGhost(a);
233
+ }
234
+
235
+ }
Pacman.h ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef PACMAN_H
17
+ #define PACMAN_H
18
+ //#include "FileIO.h"
19
+ #include "Fruit.h"
20
+ #include "Maze.h"
21
+
22
+ class Pacman
23
+ {
24
+ private:
25
+ char c;
26
+ int x;
27
+ int y;
28
+ int Ox;
29
+ int Oy;
30
+ //FileIO fileIO;
31
+ public:
32
+ Pacman();
33
+ int getPacmanX();
34
+ int getPacmanY();
35
+ void Move(Game &g, Maze &m,Utilities u, int &dot, Ghost &ga, Ghost &gb, Ghost &gc, Ghost &gd, Utilities &ud,Utilities &uc,Utilities &ub,Utilities &ua,Utilities &z, Fruit &fruit1, Utilities &f);
36
+ void Die(Utilities &u);
37
+ void OppositePosition(Game &g, Maze &m,Utilities u, int &dot);
38
+ void EatingGhost(Ghost &ghost, Game &g, Utilities &a, Utilities &u);
39
+ };
40
+ #endif
Pacman_Game_Save.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---------------------
2
+ |X........|........X|
3
+ |.|.-----.|.-----.|.|
4
+ |.|.......|.......|.|
5
+ |.|.|----.|.----|.|.|
6
+ |...|...........|...|
7
+ |--.|.-- --.|.--|
8
+ |||.|.|| ||.|.|||
9
+ |--.|.---------.|.--|
10
+ |......... |
11
+ |.---.---------.--- |
12
+ |...|.|||||||||.|.. |
13
+ |.|.|...........|.| |
14
+ |.|.|-----------|.| |
15
+ |.|......|||......| |
16
+ |.|-----.|||.-----| |
17
+ |X................. |
18
+ ---------------------
Size.cpp ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "Size.h"
2
+
3
+ int Size::getWidth() const
4
+ {
5
+ return width;
6
+ }
7
+
8
+ int Size::getHeight() const
9
+ {
10
+ return height;
11
+ }
12
+
13
+ void Size::setWidth(int w)
14
+ {
15
+ width = w;
16
+ }
17
+
18
+ void Size::setHeight(int h)
19
+ {
20
+ height = h;
21
+ }
Size.h ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef SIZE_H
17
+ #define SIZE_H
18
+
19
+ class Size
20
+ {
21
+ private:
22
+ int width;
23
+ int height;
24
+ public:
25
+ int getWidth() const;
26
+ int getHeight() const;
27
+ void setWidth(int w);
28
+ void setHeight(int h);
29
+ };
30
+
31
+ #endif
Utilities.cpp ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include "Utilities.h"
2
+
3
+ #define FOREGROUND_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
4
+ #define FOREGROUND_YELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
5
+ #define BACKGROUND_WHITE BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY
6
+
7
+ Utilities::Utilities()
8
+ {
9
+ hConsole = GetStdHandle( STD_OUTPUT_HANDLE );
10
+ }
11
+
12
+ // A function used to obtain a character from keyboard
13
+ // without having to press Enter and working in non-blocking mode
14
+ int Utilities::nonblockingGetch()
15
+ {
16
+ int ch = 0;
17
+ // force the program to stay idle for 50 milliseconds,
18
+ // i.e. do nothing for 50 ms
19
+ //_sleep(50);
20
+ // function "kbhit()" returns a non-zero integer if some key
21
+ // is pressed and returns 0 otherise.
22
+ // It will not wait for a key to be pressed.
23
+ if(kbhit())
24
+ ch = getch();
25
+ return ch;
26
+ }
27
+
28
+ // A function to check what key is pressed.
29
+ // It also returns back the code of the input key to calling function
30
+ int Utilities::checkKey()
31
+ {
32
+ // get key using nonblockingGetch
33
+ int ch = nonblockingGetch();
34
+ return ch;
35
+ }
36
+
37
+ void Utilities::getWindowSize(Size& s)
38
+ {
39
+ _CONSOLE_SCREEN_BUFFER_INFO info;
40
+ GetConsoleScreenBufferInfo(hConsole, &info);
41
+ s.setWidth(info.dwMaximumWindowSize.X-1);
42
+ s.setHeight(info.dwMaximumWindowSize.Y-1);
43
+ }
44
+
45
+ // This function clears the console screen
46
+ void Utilities::clearConsole()
47
+ {
48
+ COORD coordinate = {0,0};
49
+ DWORD count;
50
+ CONSOLE_SCREEN_BUFFER_INFO info;
51
+ if(GetConsoleScreenBufferInfo(hConsole,&info))
52
+ {
53
+ FillConsoleOutputCharacter(hConsole, (TCHAR) 32, info.dwSize.X * info.dwSize.Y, coordinate, &count);
54
+ FillConsoleOutputAttribute(hConsole, info.wAttributes, info.dwSize.X * info.dwSize.Y, coordinate, &count);
55
+ SetConsoleCursorPosition(hConsole, coordinate);
56
+ }
57
+ }
58
+
59
+ // This function sets the position of the cursor
60
+ void Utilities::gotoXY(int x, int y)
61
+ {
62
+ COORD coordinate = {x,y};
63
+ SetConsoleCursorPosition(hConsole, coordinate);
64
+ }
65
+
66
+ // This function changes the colour of text and background
67
+ void Utilities::changeColour(WORD colour)
68
+ {
69
+ SetConsoleTextAttribute(hConsole,colour);
70
+ }
Utilities.h ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #ifndef UTILITIES_H
17
+ #define UTILITIES_H
18
+
19
+ #include <windows.h>
20
+ #include <conio.h>
21
+ #include "Size.h"
22
+ using namespace std;
23
+
24
+ #define FOREGROUND_WHITE FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE | FOREGROUND_INTENSITY
25
+ #define FOREGROUND_YELLOW FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_INTENSITY
26
+ #define BACKGROUND_WHITE BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE | BACKGROUND_INTENSITY
27
+
28
+ class Utilities
29
+ {
30
+ private:
31
+ HANDLE hConsole;
32
+ public:
33
+ Utilities();
34
+ void initScreen();
35
+ int nonblockingGetch();
36
+ int checkKey();
37
+ void getWindowSize(Size&);
38
+ void clearConsole();
39
+ void gotoXY(int x, int y);
40
+ void changeColour(WORD colour);
41
+ };
42
+
43
+ #endif
main.cpp ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ Name:Wong Pui Shan
3
+ Sdutent ID:52611804
4
+ program: AScISD
5
+ Name: HAR Chiu Kwong Samson
6
+ Sdutent ID:52629360
7
+ program: AScISD
8
+ Name: LAM Cheuk Man
9
+ Sdutent ID:52621140
10
+ program: AScISD
11
+ Name:KO Jeffrey KO
12
+ Sdutent ID:525 695 30
13
+ program: AScISD
14
+
15
+ */
16
+ #include <iostream>
17
+ using namespace std;
18
+ #include <fstream>
19
+ #include <string>
20
+ #include "Utilities.h"
21
+ #include "Game.h"
22
+ #include "Ghost.h"
23
+ #include "Maze.h"
24
+ #include "Pacman.h"
25
+ #include "AnotherGhost.h"
26
+ #include "Fruit.h"
27
+ #include "FileIO.h"
28
+ #include <climits>
29
+ #include <ctime>
30
+
31
+
32
+
33
+ int main()
34
+ {
35
+ srand( (unsigned int) time(NULL) );
36
+ Game g;
37
+ g.setReplayBool(true);
38
+ //Start the game
39
+ while(true)
40
+ {
41
+ int gameLevel = g.getGameLevel();
42
+ Maze m;
43
+ FileIO fileIO;
44
+ m.printMaze(gameLevel);
45
+ m.checkTotalDot();
46
+ Utilities u;
47
+ Utilities a;
48
+ Utilities b;
49
+ Utilities c;
50
+ Utilities d;
51
+ Utilities z;
52
+ Utilities f;
53
+ int dot = 0;
54
+ int x = 10;
55
+ int y = 9;
56
+ Pacman p;
57
+ //initilize ghosts.
58
+ Fruit fruit1('!');
59
+ Ghost A(8, 7, "A");
60
+ Ghost B(9, 7, "B");
61
+ Ghost C(10, 7, "C");
62
+ Ghost D(11, 7, "D");
63
+ //int life;
64
+
65
+ while (g.getLoopGameBool() && g.getReplayBool() == true)
66
+ {
67
+ //_sleep(80);
68
+
69
+ g.checkForUpLevel(m);
70
+ p.Move(g, m, u, dot, A, B, C, D, a, b, c, d, z, fruit1, f);
71
+ A.showGhost(a);
72
+ A.increaseSpeed(dot);
73
+ A.Move(m, a);
74
+ B.showGhost(b);
75
+ B.increaseSpeed(dot);
76
+ B.Move(m, b);
77
+ C.showGhost(c);
78
+ C.Move(m, c);
79
+ D.showGhost(d);
80
+ D.Move(m, d);
81
+ g.Move(m,z);
82
+ A.EatPacman(p, g, a, u, b, c, d, B, C, D);
83
+ B.EatPacman(p, g, a, u, a, c, d, A, C, D);
84
+ C.EatPacman(p, g, a, u, a, b, d, A, B, D);
85
+ D.EatPacman(p, g, a, u, a, c, b, A, C, B);
86
+ fruit1.showFruit(g, dot, m, f);
87
+
88
+ if( g.GetLife() == 0)
89
+ {
90
+ int GameOverChoice;
91
+
92
+ do{
93
+ u.gotoXY(0,21);
94
+ cout << " \n ";
95
+ u.gotoXY(0,21);
96
+ u.changeColour(FOREGROUND_WHITE);
97
+ cout << "Game Over" << endl;
98
+ cout << "1: RePlay 2: Quit: ";
99
+ cin >> GameOverChoice;
100
+ }while(GameOverChoice!=1 && GameOverChoice != 2);
101
+
102
+ if (GameOverChoice ==2)
103
+ {
104
+ g.setLoopGameBool(false);
105
+ g.setReplayBool(false);
106
+ }
107
+ else if (GameOverChoice ==1)
108
+ {
109
+ g.gameReset();
110
+ int gameLevelReset = g.getGameLevel();
111
+ m.mazeReset(gameLevelReset);
112
+ g.setLoopGameBool(false);
113
+
114
+
115
+ }
116
+ }
117
+ fileIO.SaveGame(m, u, g);
118
+ }
119
+ m.killArray();
120
+ g.setLoopGameBool(true);
121
+ std::system ("cls");
122
+ if (g.getGameLevel() ==4 || g.getReplayBool() == false || fileIO.getQuitAfterSave()==true)
123
+ {
124
+ if(g.getGameLevel() ==4)
125
+ {
126
+ char EnterToStop;
127
+ cout << "Your are Win the Game! Thank you :D \nInput Any 'Char' or 'Number', and Press 'Enter' key to Exit" <<endl;
128
+ cin >> EnterToStop;
129
+ }
130
+ break;
131
+ }
132
+ }
133
+ std::system("pause");
134
+ return 0;
135
+ }
map1.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---------------------
2
+ |X........|........X|
3
+ |.|.-----.|.-----.|.|
4
+ |.|.......|.......|.|
5
+ |.|.|----.|.----|.|.|
6
+ |...|...........|...|
7
+ |--.|.-- --.|.--|
8
+ |||.|.|| ||.|.|||
9
+ |--.|.---------.|.--|
10
+ |......... .........|
11
+ |.---.---------.---.|
12
+ |...|.|||||||||.|...|
13
+ |.|.|...........|.|.|
14
+ |.|.|-----------|.|.|
15
+ |.|......|||......|.|
16
+ |.|-----.|||.-----|.|
17
+ |X.................X|
18
+ ---------------------
map2.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---------------------
2
+ |X.................X|
3
+ |.|.-------------.|.|
4
+ |.|...............|.|
5
+ |.|.|.---------.|.|.|
6
+ |.|.|...........|.|.|
7
+ |.|.|.-- --.|.|.|
8
+ |.|.|.|| ||.|.|.|
9
+ |.|.|.---------.|.|.|
10
+ |......... .........|
11
+ |.|.|.---------.|.|.|
12
+ |.|.|.|||||||||.|.|.|
13
+ |.|.|.|||||||||.|.|.|
14
+ |.|.|.---------.|.|.|
15
+ |.|...............|.|
16
+ |.|.-------------.|.|
17
+ |X.................X|
18
+ ---------------------
map3.txt ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---------------------
2
+ |X.................X|
3
+ |.|-------.-------|.|
4
+ |.|||...........|||.|
5
+ |.|||.---------.|||.|
6
+ |.|||...........|||.|
7
+ |.|||.-- --.|||.|
8
+ |.|||.|| ||.|||.|
9
+ |.|||.---------.|||.|
10
+ |......... .........|
11
+ |.|||.---------.|||.|
12
+ |.|||...........|||.|
13
+ |.|||-----------|||.|
14
+ |.|||||||||||||||||.|
15
+ |...................|
16
+ |.|-------.-------|.|
17
+ |X.................X|
18
+ ---------------------
pacman.vcxproj ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup Label="ProjectConfigurations">
4
+ <ProjectConfiguration Include="Debug|Win32">
5
+ <Configuration>Debug</Configuration>
6
+ <Platform>Win32</Platform>
7
+ </ProjectConfiguration>
8
+ <ProjectConfiguration Include="Release|Win32">
9
+ <Configuration>Release</Configuration>
10
+ <Platform>Win32</Platform>
11
+ </ProjectConfiguration>
12
+ </ItemGroup>
13
+ <ItemGroup>
14
+ <ClCompile Include="FileIO.cpp" />
15
+ <ClCompile Include="Fruit.cpp" />
16
+ <ClCompile Include="Game.cpp" />
17
+ <ClCompile Include="Ghost.cpp" />
18
+ <ClCompile Include="main.cpp" />
19
+ <ClCompile Include="Maze.cpp" />
20
+ <ClCompile Include="Pacman.cpp" />
21
+ <ClCompile Include="Size.cpp" />
22
+ <ClCompile Include="Utilities.cpp" />
23
+ </ItemGroup>
24
+ <ItemGroup>
25
+ <ClInclude Include="FileIO.h" />
26
+ <ClInclude Include="Fruit.h" />
27
+ <ClInclude Include="Game.h" />
28
+ <ClInclude Include="Ghost.h" />
29
+ <ClInclude Include="Maze.h" />
30
+ <ClInclude Include="Pacman.h" />
31
+ <ClInclude Include="Size.h" />
32
+ <ClInclude Include="Utilities.h" />
33
+ </ItemGroup>
34
+ <PropertyGroup Label="Globals">
35
+ <ProjectGuid>{578172A1-AD7A-4F06-BCE0-5990CDD8E293}</ProjectGuid>
36
+ <Keyword>Win32Proj</Keyword>
37
+ <RootNamespace>pacman</RootNamespace>
38
+ </PropertyGroup>
39
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
40
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
41
+ <ConfigurationType>Application</ConfigurationType>
42
+ <UseDebugLibraries>true</UseDebugLibraries>
43
+ <CharacterSet>Unicode</CharacterSet>
44
+ </PropertyGroup>
45
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
46
+ <ConfigurationType>Application</ConfigurationType>
47
+ <UseDebugLibraries>false</UseDebugLibraries>
48
+ <WholeProgramOptimization>true</WholeProgramOptimization>
49
+ <CharacterSet>Unicode</CharacterSet>
50
+ </PropertyGroup>
51
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
52
+ <ImportGroup Label="ExtensionSettings">
53
+ </ImportGroup>
54
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
55
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
56
+ </ImportGroup>
57
+ <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
58
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
59
+ </ImportGroup>
60
+ <PropertyGroup Label="UserMacros" />
61
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
62
+ <LinkIncremental>true</LinkIncremental>
63
+ </PropertyGroup>
64
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
65
+ <LinkIncremental>false</LinkIncremental>
66
+ </PropertyGroup>
67
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
68
+ <ClCompile>
69
+ <PrecompiledHeader>
70
+ </PrecompiledHeader>
71
+ <WarningLevel>Level3</WarningLevel>
72
+ <Optimization>Disabled</Optimization>
73
+ <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
74
+ </ClCompile>
75
+ <Link>
76
+ <SubSystem>Console</SubSystem>
77
+ <GenerateDebugInformation>true</GenerateDebugInformation>
78
+ </Link>
79
+ </ItemDefinitionGroup>
80
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
81
+ <ClCompile>
82
+ <WarningLevel>Level3</WarningLevel>
83
+ <PrecompiledHeader>
84
+ </PrecompiledHeader>
85
+ <Optimization>MaxSpeed</Optimization>
86
+ <FunctionLevelLinking>true</FunctionLevelLinking>
87
+ <IntrinsicFunctions>true</IntrinsicFunctions>
88
+ <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
89
+ </ClCompile>
90
+ <Link>
91
+ <SubSystem>Console</SubSystem>
92
+ <GenerateDebugInformation>true</GenerateDebugInformation>
93
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
94
+ <OptimizeReferences>true</OptimizeReferences>
95
+ </Link>
96
+ </ItemDefinitionGroup>
97
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
98
+ <ImportGroup Label="ExtensionTargets">
99
+ </ImportGroup>
100
+ </Project>
pacman.vcxproj.filters ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ <ItemGroup>
4
+ <Filter Include="Source Files">
5
+ <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
6
+ <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
7
+ </Filter>
8
+ <Filter Include="Header Files">
9
+ <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
10
+ <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
11
+ </Filter>
12
+ <Filter Include="Resource Files">
13
+ <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
14
+ <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
15
+ </Filter>
16
+ </ItemGroup>
17
+ <ItemGroup>
18
+ <ClCompile Include="main.cpp">
19
+ <Filter>Source Files</Filter>
20
+ </ClCompile>
21
+ <ClCompile Include="Size.cpp">
22
+ <Filter>Source Files</Filter>
23
+ </ClCompile>
24
+ <ClCompile Include="Utilities.cpp">
25
+ <Filter>Source Files</Filter>
26
+ </ClCompile>
27
+ <ClCompile Include="Maze.cpp">
28
+ <Filter>Source Files</Filter>
29
+ </ClCompile>
30
+ <ClCompile Include="Game.cpp">
31
+ <Filter>Source Files</Filter>
32
+ </ClCompile>
33
+ <ClCompile Include="Ghost.cpp">
34
+ <Filter>Source Files</Filter>
35
+ </ClCompile>
36
+ <ClCompile Include="Pacman.cpp">
37
+ <Filter>Source Files</Filter>
38
+ </ClCompile>
39
+ <ClCompile Include="Fruit.cpp">
40
+ <Filter>Source Files</Filter>
41
+ </ClCompile>
42
+ <ClCompile Include="FileIO.cpp">
43
+ <Filter>Source Files</Filter>
44
+ </ClCompile>
45
+ </ItemGroup>
46
+ <ItemGroup>
47
+ <ClInclude Include="Size.h">
48
+ <Filter>Header Files</Filter>
49
+ </ClInclude>
50
+ <ClInclude Include="Utilities.h">
51
+ <Filter>Header Files</Filter>
52
+ </ClInclude>
53
+ <ClInclude Include="Maze.h">
54
+ <Filter>Header Files</Filter>
55
+ </ClInclude>
56
+ <ClInclude Include="Game.h">
57
+ <Filter>Header Files</Filter>
58
+ </ClInclude>
59
+ <ClInclude Include="Ghost.h">
60
+ <Filter>Header Files</Filter>
61
+ </ClInclude>
62
+ <ClInclude Include="Pacman.h">
63
+ <Filter>Header Files</Filter>
64
+ </ClInclude>
65
+ <ClInclude Include="Fruit.h">
66
+ <Filter>Header Files</Filter>
67
+ </ClInclude>
68
+ <ClInclude Include="FileIO.h">
69
+ <Filter>Header Files</Filter>
70
+ </ClInclude>
71
+ </ItemGroup>
72
+ </Project>
pacman.vcxproj.user ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
+ </Project>