mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-11 19:48:54 +01:00
examples/platformer: Enable arrow keys
This commit is contained in:
parent
38293f13d5
commit
73a0a6a92b
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user