Fix turret rotation center
This commit is contained in:
parent
5e162fcf20
commit
547089d478
1 changed files with 6 additions and 6 deletions
12
game/game.go
12
game/game.go
|
@ -597,9 +597,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||
op.GeoM.Translate(float64(x), float64(y))
|
||||
screen.DrawImage(tankHullImages[1], op)
|
||||
op = &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Translate(-51, -51)
|
||||
op.GeoM.Translate(-50, -50)
|
||||
op.GeoM.Rotate(math.Pi/2 + g.title1)
|
||||
op.GeoM.Translate(51, 51)
|
||||
op.GeoM.Translate(50, 50)
|
||||
op.GeoM.Translate(float64(x), float64(y))
|
||||
screen.DrawImage(tankTurretImages[1], op)
|
||||
|
||||
|
@ -611,9 +611,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||
op.GeoM.Translate(float64(x), float64(y))
|
||||
screen.DrawImage(tankHullImages[2], op)
|
||||
op = &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Translate(-51, -51)
|
||||
op.GeoM.Translate(-50, -50)
|
||||
op.GeoM.Rotate(math.Pi/2 + math.Pi + g.title2)
|
||||
op.GeoM.Translate(51, 51)
|
||||
op.GeoM.Translate(50, 50)
|
||||
op.GeoM.Translate(float64(x), float64(y))
|
||||
screen.DrawImage(tankTurretImages[2], op)
|
||||
|
||||
|
@ -830,9 +830,9 @@ func (g *Game) Draw(screen *ebiten.Image) {
|
|||
offset(op)
|
||||
screen.DrawImage(tankHullImages[state.S], op)
|
||||
op = &ebiten.DrawImageOptions{}
|
||||
op.GeoM.Translate(-51, -51)
|
||||
op.GeoM.Translate(-50, -50)
|
||||
op.GeoM.Rotate(math.Pi/2 + state.R + state.T)
|
||||
op.GeoM.Translate(51, 51)
|
||||
op.GeoM.Translate(50, 50)
|
||||
op.GeoM.Translate(float64(state.X), float64(state.Y))
|
||||
offset(op)
|
||||
if state.Hit {
|
||||
|
|
Loading…
Reference in a new issue