From 27ad0453c3d7e1725c44898e9f9ea8b3933c6cdc Mon Sep 17 00:00:00 2001 From: Sander Schobers Date: Sat, 28 Dec 2019 00:02:54 +0100 Subject: [PATCH] Improved movement. - Now listening on key-char event instead of key-down. --- cmd/krampus19/playlevel.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/krampus19/playlevel.go b/cmd/krampus19/playlevel.go index bc0b162..fc4907e 100644 --- a/cmd/krampus19/playlevel.go +++ b/cmd/krampus19/playlevel.go @@ -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