I expect this to be a rectangle starting at y=256 and extending 256 pixels above. Therefore, when I change the height, I expect the rectangle to still be anchored at the bottom, and the top side to move down. In other words, I expect
this.bar.height = 128
to result in the rectangle top side to “drop” to y=128. Instead, what I observe is the rectangle being anchored a the top side, and the bottom side “moving up”. Is this expected?
setSize() does not change the result, the bar is shrinking from the wrong side. Assigning displayHeight works, but it’s not clear to me whether that’s the right solution. Isn’t displayHeight also affected by the game scaling policy?
Changing this value will not change the size that the Game Object is rendered in-game. For that you need to either set the scale of the Game Object ( setScale ) or use the displayHeight property.