/** * Map::next() * マップをワンステップ進行させます. * カーソルキーが入力されるまでは進行待ち状態になります */ void Map::next() { Tui *tui = new Tui(); tui->printCharacterLife(character->life()); tui->printMap(this); character->move(Window::getKeyStroke(), getMaze()); enemy->move(getMaze()); if (character->isHit(enemy->x(), enemy->y())) { character->decreaseLife(); } delete tui; }
/** * Map::__construct() * @param: width : int * @param: height : int * コンストラクタが呼び出す共通処理を行います.具体的には, * 座標の設定,迷路の生成,キャラクターの登録,Windowの初期化を行います. */ void Map::__construct(int width, int height) { maze = vector<vector<int>>(width, vector<int>(height, ENPTY)); this->_width = width; this->_height = height; initMaze(); character = new Character(); enemy = new Enemy(); enemy->spown(getMaze(), _width, _height); Window::initalize(); }
void MazeInit(int argc, char **argv) { getMaze(); setRandom(); InitDisplay(argc, argv); NewPosition(M); printf("%d X LOC \n",M->xloc().value()); /* * We don't do ShowPosition() or ShowView() here, but let the update * routine in the window handler do it for the first time when * the window is exposed. */ netInit(); StartDisplay(); RatCursor(); }