/* Name:Wong Pui Shan Sdutent ID:52611804 program: AScISD Name: HAR Chiu Kwong Samson Sdutent ID:52629360 program: AScISD Name: LAM Cheuk Man Sdutent ID:52621140 program: AScISD Name:KO Jeffrey KO Sdutent ID:525 695 30 program: AScISD */ #include using namespace std; #include #include #include "Utilities.h" #include "Game.h" #include "Ghost.h" #include "Maze.h" #include "Pacman.h" #include "AnotherGhost.h" #include "Fruit.h" #include "FileIO.h" #include #include int main() { srand( (unsigned int) time(NULL) ); Game g; g.setReplayBool(true); //Start the game while(true) { int gameLevel = g.getGameLevel(); Maze m; FileIO fileIO; m.printMaze(gameLevel); m.checkTotalDot(); Utilities u; Utilities a; Utilities b; Utilities c; Utilities d; Utilities z; Utilities f; int dot = 0; int x = 10; int y = 9; Pacman p; //initilize ghosts. Fruit fruit1('!'); Ghost A(8, 7, "A"); Ghost B(9, 7, "B"); Ghost C(10, 7, "C"); Ghost D(11, 7, "D"); //int life; while (g.getLoopGameBool() && g.getReplayBool() == true) { //_sleep(80); g.checkForUpLevel(m); p.Move(g, m, u, dot, A, B, C, D, a, b, c, d, z, fruit1, f); A.showGhost(a); A.increaseSpeed(dot); A.Move(m, a); B.showGhost(b); B.increaseSpeed(dot); B.Move(m, b); C.showGhost(c); C.Move(m, c); D.showGhost(d); D.Move(m, d); g.Move(m,z); A.EatPacman(p, g, a, u, b, c, d, B, C, D); B.EatPacman(p, g, a, u, a, c, d, A, C, D); C.EatPacman(p, g, a, u, a, b, d, A, B, D); D.EatPacman(p, g, a, u, a, c, b, A, C, B); fruit1.showFruit(g, dot, m, f); if( g.GetLife() == 0) { int GameOverChoice; do{ u.gotoXY(0,21); cout << " \n "; u.gotoXY(0,21); u.changeColour(FOREGROUND_WHITE); cout << "Game Over" << endl; cout << "1: RePlay 2: Quit: "; cin >> GameOverChoice; }while(GameOverChoice!=1 && GameOverChoice != 2); if (GameOverChoice ==2) { g.setLoopGameBool(false); g.setReplayBool(false); } else if (GameOverChoice ==1) { g.gameReset(); int gameLevelReset = g.getGameLevel(); m.mazeReset(gameLevelReset); g.setLoopGameBool(false); } } fileIO.SaveGame(m, u, g); } m.killArray(); g.setLoopGameBool(true); std::system ("cls"); if (g.getGameLevel() ==4 || g.getReplayBool() == false || fileIO.getQuitAfterSave()==true) { if(g.getGameLevel() ==4) { char EnterToStop; cout << "Your are Win the Game! Thank you :D \nInput Any 'Char' or 'Number', and Press 'Enter' key to Exit" <> EnterToStop; } break; } } std::system("pause"); return 0; }