mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 11:18:54 +01:00
examples/snake: update comments (#2869)
This commit is contained in:
parent
b73d63da29
commit
ef1fea890f
@ -102,6 +102,8 @@ func (g *Game) reset() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *Game) Update() error {
|
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 inpututil.IsKeyJustPressed(ebiten.KeyArrowLeft) || inpututil.IsKeyJustPressed(ebiten.KeyA) {
|
||||||
if g.moveDirection != dirRight {
|
if g.moveDirection != dirRight {
|
||||||
g.moveDirection = dirLeft
|
g.moveDirection = dirLeft
|
||||||
|
Loading…
Reference in New Issue
Block a user