Change Text Displayed with Display Text Behavior
Hello -
@Armelline did a great write-up on the Display Text behavior back in March 2015. However, there is an issue which needs to be addressed (unless I missed it): How do you change the text displayed with the Display Text behavior in an actor?
My situation is as follows. I have one actor to display two text messages, "Get Ready" and after 5 seconds "Go". So the behavrios used were:
Display Text "Get Ready"
Timer After 5 Seconds (Run to Completion)
Display Text "Go"
The above yields "Get Ready" and "Go" on the same line.
I also tried the expression editor, using quotes, but the end result is the same, both texts on the same line. The vexing part is that a score or a timer work just fine. Do I have to give my text some other treatment for this to work?
Thanks, regards.
Best Answers
-
Two.E Posts: 599
Maybe A timer that says
For 5 seconds
Display "Get Ready"
After 5 Seconds
Display "Go"
Would be nice to know a better alternative though. Thinking about it now, I can see how this could be annoying.
Answers
Well, I'll be. Worked like a charm. It seems the first timer makes the text value or expression "updateable" on a subsequent invoking of the behavior. Thanks a lot!!!
My Blog / App Store / Google Play
The above method doesn't make the text updatable. It just two seperate ones turning on and off at different times.
If you want the text updatable, you will need to use a table.
In row 1: Get Ready
In row 2: Set
In row 3: Go
Then create an attribute and give it a value of 1.
Then in the display text behaviour, put:
Table(table1,new.attribute,1).
Then after 5 seconds, change the new.attribute to a value of 2.
This way, if you want to display a lot of different texts, all you need to change is the new.attribute value to match the table row you want.
Hope it helps
GSLearn.com | Templates | Free Demos | Udemy Course
I always thought self.Time was always running.
Therfore, this will only work if the count down is set on a new scene. Because Self.Time will begin from 0. Otherwise the player would have to wait 50+ seconds before it changes to "Go"?
GSLearn.com | Templates | Free Demos | Udemy Course
It runs from the point at which the actor appears in the scene, so in a sitatuion like the start of a race (get ready . . . go!) I'd just spawn the display actor whenever/whereever I need it.
I don't understand ? Where does the 50 seconds figure come from ?
P.S. This method is not limited to two states, you could extend it to however many you like, like this:
When self.time <5
--Display "get ready"
Otherwise
--When self.time <10
----Display "get set"
--Otherwise
----When self time <15
------Display " . . . Ready . ."
----Otherwise
------Display "go"
@Socks
Oh, you are spawning the actor each time. Makes sense. Nice.
Don't worry about the 50 figure since you are spawning and not using a pre-placed actor.
GSLearn.com | Templates | Free Demos | Udemy Course