week5- Work is progressing nicely on my game. (a Realtime squad thing)
Starting to add some text to keep track of player status, etc.
Very basic question:
If I’m putting in combat text, (i.e. “Max has hit Thug for 5 pts of damage”), what’s the best way to clear and update this?
That is… if I just send text to that area of the screen again it obviously overwrites what was there below ans is illegible. So what’s a good way to implement “combat text” type displays. Should I be using a specific directgui control? is there a way to clear text from what I put up on the screen? or some other method?
thx for the reply, but I think I did a poor job of asking my question.
I could be wrong and I don’t have my code with me (my job frowns on my working on my game while I’m at work - imagine that! ) - but I think I was using onscreentext and as it “writes over” my last text msg - i get something unreadable after 2 calls to it.
is there a way to clear the text without destroying the object? thx!
You might want to look into having a text movement interval where after created on the desired spot, it floats up then clears itself. This way if text shows up one after another, both messages should still be legible, and it takes care of the messy cleanup. Be careful with frequently updating onscreen text changes though…it will affect your fps depending on how many and how often.
if you ain’t done some nasty stuff in your code, calling yourtexobject.setText(‘shout!’) you’ll have your text refreshed as you wish - I could be wrong but I bet 2 cent on that you have ‘forgotten’ the onscreentext instancing inside the task callback where you assign the combat messages.
calling Onscreentext - a python class - as a function as you said, means to instance that class therefore you were replicating that object n times and that explain why you saw multiple strings of text overlapping one above the other