#include #include "Player.h" Player::Player(int xstart, int ystart, DIR start_dir) { current_x = xstart; current_y = ystart; current_dir = start_dir; crashed = false; } bool Player::Move(Board* B, char fill, char other) { int tempx = current_x; int tempy = current_y; switch (Direction()) { case UP : current_y--; break; case DOWN : current_y++; break; case RIGHT : current_x++; break; case LEFT : current_x--; break; default : cout << "Fatal error in switch statement in file Player.C\n\n"; exit(1); } if (B->Is_Occupied(current_y,current_x)) crashed = true; //Uncommented else to see if that will perform death move. // else { //gotoxy (3,3); //cout << "Filling " << current_x << ',' << current_y << " with " << //fill << endl << flush; B->Fill(current_x,current_y,fill); B->Fill(tempx,tempy,other); //gotoxy (10,3); //exit(0); // } return !crashed; }