I have seen examples of HUD's showing a dynamic count of either ammunition or objects. I have the general idea of what I want, but I need to know how to update a text object dynamically in the game engine. My use case would be like so: on [collide with collectible] update[stockpile = stockpile + 1].

Basically, I want to add one to a value (dynamically displayed in a text element) every time the player collides with a certain type of mesh.

  • $\begingroup$ do you mind using the actual text object? If so it is easy. $\endgroup$ – David May 2 '15 at 1:56
  • 2
    $\begingroup$ NoviceInDisguise? using BGE???? unheard of. $\endgroup$ – Scalia May 2 '15 at 15:03
  • $\begingroup$ @VinceScalia lol, IKR? I'm even making a game o.O $\endgroup$ – VRM May 3 '15 at 1:25

you can do this using logic bricks, the following are added to the text object :

enter image description here

the Text object has a special property called text, i have added an integer property which is incremented by space key then it gets copied to the text property at each logic tick

here is the test play :

enter image description here

  • 1
    $\begingroup$ This is the general thing I wanted, thanks! I think I can just swap out the keyboard logic for a message sensor sent from the collectible. $\endgroup$ – VRM May 2 '15 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.