Skip to content

Trouble with aligning ex.Text with ex.Actor properly #2466

Answered by eonarheim
RyanGrieb asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @RyanGrieb thanks for opening a discussion!

I can think of a couple things you can try to re-position the text graphic.

  • ex.Text draws from the bottom left of the text glyphs by default on the ex.BaseAlign.Alphabetic, try setting it to ex.BaseAlgin.Top?
this.text.font.baseAlign = ex.BaseAlign.Top;
  • Try specifying a graphics offset when you call show() to shift the graphics down
this.graphics.show(this.text, {
  offset: ex.vec(0, this.text.localbounds.height) 
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@RyanGrieb
Comment options

Answer selected by RyanGrieb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants