diff --git a/Tutorial:Handle-user-inputs.md b/Tutorial:Handle-user-inputs.md index da53e78..45393ee 100644 --- a/Tutorial:Handle-user-inputs.md +++ b/Tutorial:Handle-user-inputs.md @@ -11,9 +11,7 @@ import ( ) func update(screen *ebiten.Image) error { - if err := ebitenutil.DebugPrint(screen, "Our first game in Ebiten!"); err != nil { - return err - } + ebitenutil.DebugPrint(screen, "Our first game in Ebiten!") return nil } @@ -126,9 +124,7 @@ func update(screen *ebiten.Image) error { x, y := ebiten.CursorPosition() // Display the information with "X: xx, Y: xx" format - if err := ebitenutil.DebugPrint(screen, fmt.Sprintf("X: %d, Y: %d", x, y)); err != nil { - return err - } + ebitenutil.DebugPrint(screen, fmt.Sprintf("X: %d, Y: %d", x, y)) return nil } @@ -171,27 +167,19 @@ And then change your `update()` function to the following code: func update(screen *ebiten.Image) error { // When the gamepad "up button" is pressed ... if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton12) { - if err := ebitenutil.DebugPrint(screen, "You're pressing the 'UP' gamepad button."); err != nil { - return err - } + ebitenutil.DebugPrint(screen, "You're pressing the 'UP' gamepad button.") } // When the gamepad "down button" is pressed ... if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton13) { - if err := ebitenutil.DebugPrint(screen, "\nYou're pressing the 'DOWN' gamepad button."); err != nil { - return err - } + ebitenutil.DebugPrint(screen, "\nYou're pressing the 'DOWN' gamepad button.") } // When the gamepad "left button" is pressed ... if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton14) { - if err := ebitenutil.DebugPrint(screen, "\n\nYou're pressing the 'LEFT' gamepad button."); err != nil { - return err - } + ebitenutil.DebugPrint(screen, "\n\nYou're pressing the 'LEFT' gamepad button.") } // When the gamepad "right button" is pressed ... if ebiten.IsGamepadButtonPressed(0, ebiten.GamepadButton15) { - if err := ebitenutil.DebugPrint(screen, "\n\n\nYou're pressing the 'RIGHT' gamepad button."); err != nil { - return err - } + ebitenutil.DebugPrint(screen, "\n\n\nYou're pressing the 'RIGHT' gamepad button.") } return nil @@ -222,16 +210,12 @@ func update(screen *ebiten.Image) error { ebiten.GamepadAxis(0, 2), // 2:The horizontal value of the right axis ebiten.GamepadAxis(0, 3)} // 3:The vertical value of the right axis - if err := ebitenutil.DebugPrint(screen, fmt.Sprintf("0: %0.6f, 1: %0.6f", + ebitenutil.DebugPrint(screen, fmt.Sprintf("0: %0.6f, 1: %0.6f", axes[0], - axes[1])); err != nil { - return err - } - if err := ebitenutil.DebugPrint(screen, fmt.Sprintf("\n2: %0.6f, 3: %0.6f", + axes[1])) + ebitenutil.DebugPrint(screen, fmt.Sprintf("\n2: %0.6f, 3: %0.6f", axes[2], - axes[3])); err != nil { - return err - } + axes[3])) return nil }