/* 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 "Game.h" #include "Maze.h" #include "Utilities.h" #include using namespace std; Game::Game() { level = 1; life = 3; point = 0; loopGame = true; addLife = 0; } void Game::setPoint(int x) { point += x; } void Game::print1() { //show the level and Game Point // Extra Life when user meet more than 8888 points cout << "Level: " << level << "\tGP:" << point << endl; bool check = false; if(point > 8888 && addLife==0 ) { check = true; while(check) { extraLife(); check = false; addLife++; } } } void Game::print2() { cout << "Life left: " << life << " "; switch(level){ case 1: cout << "Fruit:Cherry " << endl; break; case 2: cout << "Fruit:Strayberry " << endl; break; case 3: cout << "Fruit:Orange " << endl; break; } } int Game::getPoint() { return point; } void Game::Move(Maze m,Utilities u) { u.gotoXY(0,18); u.changeColour(FOREGROUND_WHITE); Game::print1(); Game::print2(); u.gotoXY(0,20); cout << " "; u.gotoXY(0,20); cout << "Remain Dot: "<< m.getTotalDot() << endl; cout << "Press p to pause"; u.changeColour(FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE); } int Game::GetLife(){ return life; } void Game::setLife() { life = 3; } void Game::extraLife() { life++; } bool Game::getLoopGameBool() { return loopGame; } void Game::setLoopGameBool(bool temp) { loopGame = temp; } void Game::checkForUpLevel(Maze &m) { if (m.getTotalDot()==0) { setGameLevel(); setLoopGameBool(false); } } void Game::setGameLevel() { level++; } int Game::getGameLevel() { return level; } void Game:: setReplayBool(bool temp) { replay = temp; } bool Game::getReplayBool() { return replay; } void Game::gameReset() { level = 1; life = 3; point = 0; loopGame = true; }