I have a timer that isn’t staying stationary when it is counting down – due to the numbers being different widths.
I’m using the following for my timer:
timer = [CCLabelBMFont labelWithString:@"" fntFile:@"myFont.fnt"];
How do you keep the timer stationary while counting down?
Thanks.
When you are saying “stationary”, do you mean “left side isn’t staying in the same place”?
CCNodeclass hasanchorPointproperty, which determines which point of this node is “pinned” to the point in node’s parent. Anchor point of (0, 0) means bottom left corner, (1, 1) – top right, (0.5, 0.5) – center. All positioning and transformations take place around anchor point.Set
anchorPointproperty of your label to mean the point which you want to have “pinned” when content size of label changes. For example, if you want top left corner to be stationary: