Skip to content

Commit

Permalink
Fix snake game getting softlocked when hitting the leftmost boundary
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentFoulon80 committed Feb 17, 2023
1 parent 55617eb commit 6b32279
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/snake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ impl Snake {
// Initialize game values to a starting state
self.playing = true;
self.direction = Direction::East;
self.old_dx = 1;
self.old_dy = 0;
self.pos_x = 4;
self.pos_y = 4;
self.body = vec![(3, 4), (2, 4)];
Expand Down

0 comments on commit 6b32279

Please sign in to comment.