本文整理汇总了C++中Maze::getMaze方法的典型用法代码示例。如果您正苦于以下问题:C++ Maze::getMaze方法的具体用法?C++ Maze::getMaze怎么用?C++ Maze::getMaze使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Maze
的用法示例。
在下文中一共展示了Maze::getMaze方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processMovement
void Logic::processMovement(Pacman &pacman, Maze &maze)
{
Vector2<int> coords(0,0);
switch(pacman.getDirection())
{
case Direction::UP:
coords.x = pacman.getPosition().x;
coords.y = pacman.getPosition().y - 1;
break;
case Direction::DOWN:
coords.x = pacman.getPosition().x;
coords.y = pacman.getPosition().y + 1;
break;
case Direction::LEFT:
coords.x = pacman.getPosition().x - 1;
coords.y = pacman.getPosition().y;
break;
case Direction::RIGHT:
coords.x = pacman.getPosition().x + 1;
coords.y = pacman.getPosition().y;
break;
case Direction::STOP:
coords.x = pacman.getPosition().x;
coords.y = pacman.getPosition().y;
break;
}
if(maze.getMaze()[coords.x][coords.y].getType() != Type::NOTHING)
{
if(Physics::isIntersects(&pacman, &maze.getMaze()[coords.x][coords.y], pacman.getDirection()))
{
switch(maze.getMaze()[coords.x][coords.y].getType())
{
case Type::PILL:
pacman.setScore(pacman.getScore() + 2);
maze.getMaze()[coords.x][coords.y].setType(Type::NOTHING);
cellsToChange.setXY(coords.x, coords.y);
break;
case Type::BONUS:
break;
case Type::WALL:
pacman.setDirection(Direction::STOP);
break;
}
}
}
pacman.setMovingVector();
}
示例2: ErrorBomberman
void IA::update(GameEngine *game, Maze &maze) {
std::list<Bomb *>::iterator it_bomb = this->m_bomb.begin();
int action;
int x;
int y;
if (this->m_time > 42) {
this->m_time = 0;
x = this->m_position % this->m_width;
y = this->m_position / this->m_width;
this->IsAlive(maze);
if (this->m_alive) {
action = this->m_lua->getPosition(maze.getMaze(), x, y);
if (action == -1)
throw ErrorBomberman("Error with lua bind", "IA");
else if (action < IA_NONE)
(this->*m_func[action])(maze, game->getClock());
}
}
this->m_time = this->m_time + 1;
try {
while (it_bomb != this->m_bomb.end()) {
(*it_bomb)->update(game->getClock(), maze);
if ((*it_bomb)->getState() == TODELETE) {
delete *it_bomb;
it_bomb = this->m_bomb.erase(it_bomb);
}
++it_bomb;
}
}
catch (ErrorBomberman const &e) {
throw ErrorBomberman(e.what(), "IA");
}
}
示例3:
void IA::MoveDown(Maze &maze, gdl::Clock &) {
if (this->m_alive == true) {
this->m_direction = DOWN;
this->m_tomove = this->move(maze.getMaze(), maze.getWidth());
}
}