From ce2168c0d6e8919aa1047c06c9942acd731489c9 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Sun, 8 Apr 2018 00:38:52 +0900 Subject: [PATCH] examples/flappy: Bug fix: wrong calculation of rotating --- examples/flappy/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/flappy/main.go b/examples/flappy/main.go index a2a54339d..63a41be68 100644 --- a/examples/flappy/main.go +++ b/examples/flappy/main.go @@ -371,10 +371,10 @@ func (g *Game) drawTiles(screen *ebiten.Image) { func (g *Game) drawGopher(screen *ebiten.Image) { op := &ebiten.DrawImageOptions{} - _, h := gopherImage.Size() - op.GeoM.Translate(-float64(h)/2.0, -float64(h)/2.0) + w, h := gopherImage.Size() + op.GeoM.Translate(-float64(w)/2.0, -float64(h)/2.0) op.GeoM.Rotate(float64(g.vy16) / 96.0 * math.Pi / 6) - op.GeoM.Translate(float64(h)/2.0, float64(h)/2.0) + op.GeoM.Translate(float64(w)/2.0, float64(h)/2.0) op.GeoM.Translate(float64(g.x16/16.0)-float64(g.cameraX), float64(g.y16/16.0)-float64(g.cameraY)) op.Filter = ebiten.FilterLinear screen.DrawImage(gopherImage, op)