Adjust origin offsets

This commit is contained in:
Ketchetwahmeegwun T. Southall 2022-01-29 22:38:53 -08:00
parent 1fedcb64fd
commit fe0b4bece5

View File

@ -51,11 +51,13 @@ export class SpriteInstance {
this.frameCount = this.subset.frames.length this.frameCount = this.subset.frames.length
this.frame = this.subset.frames[this.frameIndex] this.frame = this.subset.frames[this.frameIndex]
let s = new PIXI.Sprite(this.frame.texture) let s = new PIXI.Sprite(this.frame.texture)
s.x -= this.frame.originX let originX = this.frame.originX ?? this.frame.width/2
s.y -= this.frame.originY let originY = this.frame.originY ?? this.frame.height/2
s.x -= originX
s.y -= originY
this.container.addChild(s) this.container.addChild(s)
this.container.pivot.x -= this.frame.originX this.container.pivot.x = originX
this.container.pivot.y -= this.frame.originY this.container.pivot.y = originY
} }
} }