Displaying Text in MakeCode Arcade
You got started with Microsoft MakeCode and you know you can display numbers with the “score” function and display dialog prompts with “splash screen” but there is no way to display text with blocks (yet)!
The function, screen.print() takes in 5 parameters. A string, X value, Y Value, Color, and the font type. There are 3 supported fonts as of writing this. font5 which supports Unicode only, font8 which supports Cyrillic characters and Unicode, and font12 which is in beta and supports both and Chinese characters. You are given the ability to center it automatically with ” screen.printCenter” which gets rid of the x value.
However, this needs to be constantly updated. We can use the “game.onShade” function to display the text over sprites and the “game.onPaint” function to display under sprites. Here is a program to show you the difference and take you to Microsoft Makecode.
Make your own scaled font by using this function. “image.scaledFont()” takes in font5, font8 or font12(in beta) and a number to scale it by. The bigger the number, the bigger the string.
In the following project, you can see all the different options available to you in progress. If you have any questions, make sure to ask them on the Community Forum
Tip: Remember that special characters like Russian characters and accent marks are only supported in font8 and font12 and that font12 is beta only.