From 583f4388db8c8173478d228ad31dab54a3a18951 Mon Sep 17 00:00:00 2001 From: yohamta Date: Wed, 9 Mar 2022 19:48:14 +0900 Subject: [PATCH] Fixed a bug --- sprite.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sprite.go b/sprite.go index 509454e..b5420ff 100644 --- a/sprite.go +++ b/sprite.go @@ -124,12 +124,6 @@ func (spr *Sprite) Draw(screen *ebiten.Image, index int, opts *DrawOptions) { op.ColorM = opts.ColorM op.CompositeMode = opts.CompositeMode - if r != 0 { - op.GeoM.Translate(-w*ox, -h*oy) - op.GeoM.Rotate(r) - op.GeoM.Translate(w*ox, h*oy) - } - if spr.flippedH { sx = sx * -1 } @@ -143,6 +137,12 @@ func (spr *Sprite) Draw(screen *ebiten.Image, index int, opts *DrawOptions) { op.GeoM.Translate(w*ox, h*oy) } + if r != 0 { + op.GeoM.Translate(-w*ox, -h*oy) + op.GeoM.Rotate(r) + op.GeoM.Translate(w*ox, h*oy) + } + op.GeoM.Translate((x - w*ox), (y - h*oy)) subImage := spr.subImages[index]