Skip to content

Commit

Permalink
examples/snake: update comments (#2869)
Browse files Browse the repository at this point in the history
  • Loading branch information
temidaradev authored Dec 20, 2023
1 parent b73d63d commit ef1fea8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/snake/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ func (g *Game) reset() {
}

func (g *Game) Update() error {
// Decide the snake's direction along with the user input.
// A U-turn is forbidden here (e.g. if the snake is moving in the left direction, the snake cannot go to the right direction immediately).
if inpututil.IsKeyJustPressed(ebiten.KeyArrowLeft) || inpututil.IsKeyJustPressed(ebiten.KeyA) {
if g.moveDirection != dirRight {
g.moveDirection = dirLeft
Expand Down

0 comments on commit ef1fea8

Please sign in to comment.