/* 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 "Fruit.h" Fruit::Fruit(){ fx = 1; fy = 1; charF = '!'; number = 1; levelFruit = 1; } Fruit::Fruit(char fruit){ charF = fruit; fx = 1; fy = 1; number = 1; levelFruit = 1; } void Fruit::showFruit(Game &game, int &dot, Maze &m, Utilities &f){ //Set the fruit randomly on the map when pacman eat 70 dots levelFruit = game.getGameLevel(); if(dot == 70) { do{ fx = rand() % 21 ; fy = rand() % 18 ; dot = 0; }while(m.getMazeArray(fx, fy)=='-' || m.getMazeArray(fx, fy)=='|' || m.getMazeArray(fx, fy)=='.' || m.getMazeArray(fx, fy)=='X'); f.gotoXY(fx,fy); f.changeColour(FOREGROUND_GREEN | FOREGROUND_BLUE); switch(levelFruit){ case 1: charF = '!'; break; case 2: charF = '*'; break; case 3: charF = '#'; break; } cout << charF; m.setMazeArray(fx,fy,charF); } } Fruit::~Fruit(){ }