Pacman should not be animated when hitting a wall
This commit is contained in:
parent
f51b7d65e0
commit
a69e66d114
2 changed files with 11 additions and 1 deletions
|
@ -28,8 +28,10 @@ Position PacMan::positionInGrid() const {
|
|||
|
||||
void PacMan::update(std::chrono::milliseconds time_delta, InputState state, const Board & board) {
|
||||
setDirection(state);
|
||||
updateAnimationPosition(time_delta);
|
||||
auto old = pos;
|
||||
updateMazePosition(time_delta, board);
|
||||
if(old != pos)
|
||||
updateAnimationPosition(time_delta);
|
||||
}
|
||||
|
||||
void PacMan::setDirection(const InputState & state) {
|
||||
|
|
|
@ -19,3 +19,11 @@ using Sprite = sf::Sprite;
|
|||
inline bool operator==(const PositionInt & b, const Position & a) {
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
inline bool operator==(const Position & a, const Position & b) {
|
||||
return a.x == b.x && a.y == b.y;
|
||||
}
|
||||
|
||||
inline bool operator!=(const Position & a, const Position & b) {
|
||||
return !(a == b);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue