How can I create Zelda-esque text in UPBGE?

I want to make text that types automatically like a typewriter, and has lines, and the text wraps around the “box” object. This is seen in many games including Zelda and Pokemon and many RPGs. How to reproduce this effect via Python?

And no, I’m not saying I would like a BGText-like script. I am trying to create my own python script that does what I mentioned above, but don’t know where to start. This shouldn’t be convoluted. You can do this with Font objects, I’m sure!

A hacky way of doing it could be to keep variables in the globalDict which count cycles, and keep track of what the text object still needs to display. Each x number of cycles, update the text object with a new letter. If it’s a certain length (the width of the box) then add a new line.

eg: if you put the message you want to display in “msg” in globalDict:

if globalDict["msg"]:
    globalDict["timer"] -= 1
    if globalDict["timer"] == 0:
        globalDict["timer"] = 10
        textObject["Text"].append(globalDict["msg"][-1])
        if len(textObject["Text"]) > lineWidth:
            textObject["Text"] += "\n"
1 Like

or

Or simply combine them both

1 Like

Now, how can I make it so if I the text says something for example like “If you find this maze too hard, you can always exit via the pause menu or restart the level from the beginning” behave so that a section of text like “restart” or “pause menu” in that quote a different colour?

This is basically highlighting (changing colours of certain text areas, and this is always scripted in a way), and it’s done in many games, not just in Zelda games to highlight different objectives, enemies, items collected for the very first time and quest items that have been collected, etc.

How can I highlight certain areas of text in a different colour in the same message while leaving the rest of the text unchanged in colour, like with what I described?

Sorry to say but that is not possible. It’s all text or nothing, you can’t color parts of it. It’s a limitation of the text object.

1 Like