The new text game property

I was just looking for an example of how to use the new text game property in 2.62. Anyone made a simple example yet?

Oh, new blender version is out.

yeah text objects have a Game Text property under them. Unchangleable. Only changeable in python im guessing. Guess Ill have to wait till someone plays around with it. Or I figure it out :smiley:

Im hoping its as simple as:

obj[“Text”] = whatever_i_choose

:smiley:

If it is like the non-game font object it would be…

ob.data.body = "My Text Here"

Easy:

import bge

bl = bge.logic

c= bl.getCurrentController()
o = c.owner #Text object

if c.sensors['Keyboard'].positive:
    o['Text'] =  5 #text property is always called 'Text'

thats it dberube4

super easy. This will make things alot easier :D…thanks for the help.

:), i’m glad i’m not the only one that was confused on this, and thanks dberube4 for the info.

I just used it in my latest tutorial - This is a good addition.

Not that blf is bad or anything, but sometimes you just want to set up some quick text, and for that, bitmap fonts were too troublesome.

The text object is a very convenient addition.

@dberube4: I pasted your code into a text window but when I run it I get an error on import bge. I am using Ubuntu build with the Game Engine. I would like to see this work but I don’t know much about the game side of Blender. Can someone post a working BLEND file with this text solution?

Has anyone else had an issue when scaling text object in bge? I mean if you have a camera set so that the view is scaled into a small area and text object is scaled down enough, it starts to pixelate the text.

@Atom

The ‘text’ property act like all other object property.

Create a text object and link an ‘always’ sensor ( or any other sensors) to this code.
(the other required a keyboard sensor)

import bge 
cont = bge.logic.getCurrentController() 

own = cont.owner  

o['Text'] =  5 #text property is always called 'Text'

@ Mperonen: If »Issue« might be understood as a Bug, then it is none. It is just the Blender Text Object, which you can call a Vector Graphic, gets transformed into a Pixel Image, since the BGE does not use such Vector Graphics (it is not Flash, after all). It can, ofCourse be a Problem in your Game, but it just is that Way for logical Reason.