examples/platformer: Enable arrow keys

This commit is contained in:
Hajime Hoshi 2017-10-29 00:07:26 +09:00
parent 38293f13d5
commit 73a0a6a92b

View File

@ -44,12 +44,12 @@ var (
func update(screen *ebiten.Image) error { func update(screen *ebiten.Image) error {
// Controls // Controls
if ebiten.IsKeyPressed(ebiten.KeyA) { if ebiten.IsKeyPressed(ebiten.KeyA) || ebiten.IsKeyPressed(ebiten.KeyLeft) {
// Selects preloaded sprite // Selects preloaded sprite
loadedSprite = leftSprite loadedSprite = leftSprite
// Moves character 3px right // Moves character 3px right
charX -= 3 charX -= 3
} else if ebiten.IsKeyPressed(ebiten.KeyD) { } else if ebiten.IsKeyPressed(ebiten.KeyD) || ebiten.IsKeyPressed(ebiten.KeyRight) {
// Selects preloaded sprite // Selects preloaded sprite
loadedSprite = rightSprite loadedSprite = rightSprite
// Moves character 3px left // Moves character 3px left