From d4dcd952a458317f42a0d04fcf7a61d0000ffc33 Mon Sep 17 00:00:00 2001 From: Josh Deprez Date: Tue, 3 Aug 2021 20:09:22 +1000 Subject: [PATCH] key just pressed --- engine/actor.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/engine/actor.go b/engine/actor.go index c3da9be..7c594f0 100644 --- a/engine/actor.go +++ b/engine/actor.go @@ -7,6 +7,7 @@ import ( "math" "github.com/hajimehoshi/ebiten/v2" + "github.com/hajimehoshi/ebiten/v2/inpututil" ) const gravity = 0.5 @@ -63,7 +64,7 @@ func (a *Actor) Update() error { if a.collidesAt(a.Position.Add(image.Pt(0, 1))) { // Not falling a.vy = 0 - if ebiten.IsKeyPressed(ebiten.KeySpace) { + if inpututil.IsKeyJustPressed(ebiten.KeySpace) { // Jump? a.vy = -7 }