mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
examples/flappy: Bug fix: wrong calculation of rotating
This commit is contained in:
parent
f2e2f602c5
commit
ce2168c0d6
@ -371,10 +371,10 @@ func (g *Game) drawTiles(screen *ebiten.Image) {
|
|||||||
|
|
||||||
func (g *Game) drawGopher(screen *ebiten.Image) {
|
func (g *Game) drawGopher(screen *ebiten.Image) {
|
||||||
op := &ebiten.DrawImageOptions{}
|
op := &ebiten.DrawImageOptions{}
|
||||||
_, h := gopherImage.Size()
|
w, h := gopherImage.Size()
|
||||||
op.GeoM.Translate(-float64(h)/2.0, -float64(h)/2.0)
|
op.GeoM.Translate(-float64(w)/2.0, -float64(h)/2.0)
|
||||||
op.GeoM.Rotate(float64(g.vy16) / 96.0 * math.Pi / 6)
|
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.GeoM.Translate(float64(g.x16/16.0)-float64(g.cameraX), float64(g.y16/16.0)-float64(g.cameraY))
|
||||||
op.Filter = ebiten.FilterLinear
|
op.Filter = ebiten.FilterLinear
|
||||||
screen.DrawImage(gopherImage, op)
|
screen.DrawImage(gopherImage, op)
|
||||||
|
Loading…
Reference in New Issue
Block a user