I’m working on an extension that makes it easier to have text in your game. The big motivations for me are for creating custom UI and HUD elements as well as signage in games. Using this extension, you can basically duplicate the built-in life, score and countdown elements.
These are the blocks:
and the expandable blocks expanded:
This extension handles unicode. If non-ascii characters are entered, a unicode font will be used.
A maximum height for the text can be specified. Since our fonts in Arcade are limited, this will always be rounded down to a multiple of 5, 8, or 12. We try to use the most appropriate font for your size and whether or not unicode is present.
And of course since these are sprites all the other sprite functions work with these.
Here’s the extension:
Here’s a sample:
- What about word wrapping?
- Likely answer: allow an optional “max width” and wrap appropriately
@darzu here is that word wrapping code I mentioned the other day. Looking at it now, it’s not complicated at all but at least I figured out the text ranges for punctuation!
is there a way to update the text i real time?
Yes, the “set textSprite text (”")" block can be called as frequently as you like, perhaps in a “on game update” block if you want to report a frequently changing timer or score
Is that the “Water” in Japanese? I knew that because… well I just know it.
Gonna speak some chinese.
Just to prevent any racism.
I am Asian. I know what that means. You said: What am I doing?
It actually means what did I say.
I thought it meant what did I say too
This is getting offtopic
Looks like it might mean water in both Japanese and Chinese, so I think you’re both right?
Also, I updated the links in this forum post with new links now that the extension is officially being release and maintained by MakeCode. Going forward updates to the extension will happen to the microsoft/arcade-text repo not the darzu/arcade-text one.
On that note, there’s a new block:
that can be used for awesome outlines like: