In my game class, I created an element:
private winAmountText: PIXI.Text = new PIXI.Text('0')
Within the constructor, I have the following code:
this.winAmountText.style = new PIXI.TextStyle({
fill: 0xFFFFFF,
fontSize: 86
})
this.setWinAmountText(0)
store.subscribe(() =>
this.setWinAmountText(store.getState().winAmount)
)
This is the function I am using:
private setWinAmountText(value: number) {
this.winAmountText.text = value.toString()
this.winAmountText.x = this.width * 0.56 - this.winAmountText.width
this.winAmountText.y = this.height * 0.905
}
Upon opening the page, the win amount text displays correctly. However, when the state updates, the win amount moves to the top left corner.
Any suggestions on how to resolve this issue?