2
$\begingroup$

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.

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

1 Answer 1

4
$\begingroup$

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

$\endgroup$
1
  • 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$
    – J Sargent
    May 2, 2015 at 11:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .