I have a couple of ideas for simple games (new to BGE pretty much and NO skill with Python). I was wondering if there’s a way to display a line or two of text in the BGE that can update as the values/scores change. I can place text meshes for permanent text such as “SCORE:” but then I would follow that with numbers that would change as the game progresses, such as “SCORE: 19”. I’ve seen the “message” sensor and actuator, but I don’t see how they could send a score “message” to a display somehow.
Text objects have a property “Text” that is equal to what they display. You can change this property to equal the score value. This is easiest with Python but there is probably a way with logic bricks.
textobject["Text"] = score
simple demo file : send a score “message” to a display
demo.blend (63.7 KB)
This is a fairly basic part of any game and one of the more common ways to do this is using text overlays in front of the camera, (see here for a simple introduction,).
To update the scores in real time, you are unlikely to escape using python, though there are any number of tutorials and demo scripts on how to do this, but in essence you just write a new string to the text property of the plane.
You can find a solution at the BGE Guide to Messages incl. Healthbar tutorial
Elfaz I tried the demo.blend. I don’t get any errors, but it doesn’t change the score when I press the spacebar. I’m running 2.63 if that matters.
***** Update *****
It’s working now. For some reason, when I started Blender by clicking on the demo.blend file, it didn’t work, but if I start Blender first, then open the demo.blend file, it’s OK.
Hi… im a new… any sugestion? In bge there is a debug properties, how to copy one of those value into a text