diff --git a/cmd/krampus19/playlevelstate.go b/cmd/krampus19/playlevelstate.go index 2220cf6..92f1588 100644 --- a/cmd/krampus19/playlevelstate.go +++ b/cmd/krampus19/playlevelstate.go @@ -124,24 +124,6 @@ func (s *playLevelState) tryPlayerMove(dir geom.Point, key allg5.Key) { return } - s.steps++ - log.Printf("Moving player to %s", to) - s.ani.StartFn(s.ctx.Tick, newMoveAnimation(s.player, to), func() { - log.Printf("Player movement finished") - if s.player.pos == s.egg.pos { - s.complete = true - if onComplete := s.onComplete; onComplete != nil { - onComplete() - } - } else { - pressed := s.keysDown.ArePressed(s.ctx.Settings.Controls.MovementKeys()...) - if len(pressed) == 1 { - log.Printf("Movement key %s is down, moving further", gut.KeyToString(key)) - s.TryPlayerMove(pressed[0]) - } - } - }) - if brick := s.bricks.FindEntity(to); brick != nil { log.Printf("Pushing brick at %s", to) brickTo := to.Add(dir) @@ -161,6 +143,24 @@ func (s *playLevelState) tryPlayerMove(dir geom.Point, key allg5.Key) { } }) } + + s.steps++ + log.Printf("Moving player to %s", to) + s.ani.StartFn(s.ctx.Tick, newMoveAnimation(s.player, to), func() { + log.Printf("Player movement finished") + if s.player.pos == s.egg.pos { + s.complete = true + if onComplete := s.onComplete; onComplete != nil { + onComplete() + } + } else { + pressed := s.keysDown.ArePressed(s.ctx.Settings.Controls.MovementKeys()...) + if len(pressed) == 1 { + log.Printf("Movement key %s is down, moving further", gut.KeyToString(key)) + s.TryPlayerMove(pressed[0]) + } + } + }) } func (s *playLevelState) canMove(from, dir geom.Point) bool {