All courses / C# Basics for Game Makers / Your first program

Printing a text box

Challenge lesson, about 9 min, +20 XP

Inside the tower, Nico stops at the trading stall. The game shows the blacksmith's words in a frame, so the player can tell speech from scenery. You can build that frame today with nothing but lines of text: the keyboard characters +, - and |. No graphics and no engine.

The console shows text in a monospaced font. Every character, including each space, takes exactly the same width. So if two lines have the same number of characters, they end at the same spot on screen. A text box is therefore a counting job, not an art job. Count right and the edges line up. Count wrong and the box looks like it lost a fight.

Read the rest of this lesson and run the code in your browser.

Previous: Predict the output   Next: Fixing compiler errors

© 2026 Xero Media LLC. All rights reserved.