From 3fb808ba785acca796f58ead2da72609facd5725 Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sun, 29 Dec 2019 17:29:33 +0100 Subject: [PATCH] Fixed bug where player isn't able walk when any animation is playing. --- cmd/krampus19/playlevelstate.go | 4 +--- gut/animation.go | 4 ---- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/cmd/krampus19/playlevelstate.go b/cmd/krampus19/playlevelstate.go index f1a5a4a..4ad04c4 100644 --- a/cmd/krampus19/playlevelstate.go +++ b/cmd/krampus19/playlevelstate.go @@ -97,7 +97,7 @@ func (s *playLevelState) Tick(now time.Duration) { } func (s *playLevelState) TryPlayerMove(dir geom.Point, key allg5.Key) { - if !s.isIdle() { + if s.player.scr.pos != s.player.pos.ToF32() { return } @@ -179,8 +179,6 @@ func (s *playLevelState) findEntityAt(pos geom.Point) *entity { return s.sunken.FindEntity(pos) } -func (s *playLevelState) isIdle() bool { return s.ani.Idle() } - func (s *playLevelState) isObstructed(pos geom.Point, idx int, t tile) bool { if s.bricks.FindEntity(pos) != nil { return true // brick diff --git a/gut/animation.go b/gut/animation.go index 7adbf79..722e1a1 100644 --- a/gut/animation.go +++ b/gut/animation.go @@ -18,10 +18,6 @@ type animation struct { done AnimationDoneFn } -func (a *Animations) Idle() bool { - return len(a.anis) == 0 -} - func (a *Animations) Start(now time.Duration, ani Animation) { a.StartFn(now, ani, nil) }