Changed behaviour of player after brick has been sunken.
- Previously the player would stop on the current tile even if the correct key was pressed. Now the movement continues without interruption.
This commit is contained in:
parent
041cdccc3f
commit
a19d33cb9f
@ -124,24 +124,6 @@ func (s *playLevelState) tryPlayerMove(dir geom.Point, key allg5.Key) {
|
|||||||
return
|
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 {
|
if brick := s.bricks.FindEntity(to); brick != nil {
|
||||||
log.Printf("Pushing brick at %s", to)
|
log.Printf("Pushing brick at %s", to)
|
||||||
brickTo := to.Add(dir)
|
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 {
|
func (s *playLevelState) canMove(from, dir geom.Point) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user