How do you make the text object be centered when created? It seems that alignment doesn’t affect it. I ask because I’m using tweening to create an effect and it is happening from the default, upper left position.
The “Alignment” action/setting means “Text alignment within the text object”. If you only have a single line of text, there’s nothing to align it to (since the text objects adjust to the size of the text within it). If you have multiple lines of text, the text will be center/left/right aligned depending on alignment, but again, only compared to the rest of the text lines in the object.
Outside of that, if you want to center an object upon creation, you either need to create it centered to the camera (CameraCenter expressions as the destination of your “Create object” actions, find them in the expression builder, you’ll want to combine them with 1/2 the width of your text object, again using the expression builder). or if you’re placing them in the scene editor you’ll need to place them manually at the centered location.
Thank you for the info. I saw the other post with this info. What I was wondering about was making a text object be centered in yerms of effects and behaviors. I was trying to make it tween and “pulse,” from the center. Now, instead, I’m using a sprite.
Not sure I understand, no reason you can’t use a text object for this. The positioning would be the same as with a sprite.
With a sprite you can change the origin and center point. With text it always seems oriented to 0 X, 0 Y. Is that incorrect?
Ah, I thought you meant positioning. As a heads up, generally you should avoid changing the origin point on anything unless absolutely necessary, but you are correct that only sprite objects can have custom points.
However, really all you have to do for “center” is to do YourTextObjectHere.Width()/2 or Height/2.
So if you want to create the text object at the center of the screen, it would be CenterCameraX(“yourlayerhere”,0)-(YourTextObjectHere.Width()/2). Or If you’re tweening to a specific position, it’d be “Tween X position of YourTextObjectHere to 500-(YourTextObjectHere.Width()/2)” and the same idea for height (although normally that’ll be +, not -)
I understand what you’re saying. What I wanted was for it to grow and shrink from a central point. I accomplished that with a sprite. Thank you.
You could possibly re-center it by every frame…
Thank you for the idea. Here’s what I was trying to do. A sprite did it best, I think: