pacman/lib/Direction.hpp
Corentin Jabot c2cfb8c734 Implement ghost movement and scatter behavior
Each ghost is trying to reach a point beyond the
corner of the board, which make them run in circle
2021-07-01 10:19:46 +02:00

22 lines
422 B
C++

#pragma once
enum class Direction {
NONE,
LEFT,
RIGHT,
UP,
DOWN
};
inline Direction oppositeDirection(Direction d)
{
switch (d) {
case Direction::LEFT: return Direction::RIGHT;
case Direction::RIGHT: return Direction::LEFT;
case Direction::UP: return Direction::DOWN;
case Direction::DOWN: return Direction::UP;
case Direction::NONE: return d;
}
return d;
}