Skip to content

Commit

Permalink
Fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yohamta committed Mar 9, 2022
1 parent c42405c commit 583f438
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions sprite.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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]
Expand Down

0 comments on commit 583f438

Please sign in to comment.