Improved movement.

- Now listening on key-char event instead of key-down.
This commit is contained in:
Sander Schobers 2019-12-28 00:02:54 +01:00
parent 856069d5b2
commit 27ad0453c3

View File

@ -61,7 +61,7 @@ func newEntityMoveAnimation(e *entity, to geom.Point) *entityMoveAnimation {
}
func (a *entityMoveAnimation) Animate(start, now time.Duration) bool {
const duration = 240 * time.Millisecond
const duration = 160 * time.Millisecond
progress := float32((now-start)*1000/duration) * .001
from, to := a.from.ToF32(), a.to.ToF32()
@ -78,6 +78,7 @@ func (l *playLevel) Enter(ctx *Context) error {
l.menu = alui.NewMenu()
l.menu.Add("Resume", func() { l.showMenu = false })
l.menu.Add("Restart", func() { l.ctx.Navigation.playLevel(l.name) })
l.menu.Add("Quit to main menu", func() { l.ctx.Navigation.showMainMenu() })
l.menu.Add("Quit to desktop", func() { l.ctx.Navigation.quit() })
@ -147,7 +148,7 @@ func (l *playLevel) Handle(e allg5.Event) {
}
switch e := e.(type) {
case *allg5.KeyDownEvent:
case *allg5.KeyCharEvent:
switch e.KeyCode {
case allg5.KeyEscape:
l.showMenu = true