In my game, I've got a text field made with Spritefont. This box displays a text that is appended from time to time to record player actions. It's a sort of archive of the game progress and the amount of text quickly overflows the size of the text box.
How can I allow the player to scroll through this text to explore the record ?
You can replace Text with SpriteFont.
Note, that this will only work if you have one record per line, each ending with newline. If your records are longer and getting auto-wrapped, it will scroll 2 or more lines at a time.
Thank you so much, dop2000 !
I managed to adapt it to sprite font and to add the routine I need to have lines added to record player actions (simulated it by a line added every few seconds). Scroll up when line is added works nicely
but one point remains, it is that the new created line should appear at the bottom of the text box.
How should I do that ?
You mean when a new line is added, the text should scroll to the end?
In event 2 set scrollPosition to tokencount(s, newline)-MAXLINES
It works. Thank you so much !
Now, i'll try to figure out how to make the scrolling happen using swipe movement on mobile ;)
You can use Touch.AngleAt(0) and Touch.SpeedAt(0) to detect swipes.
Develop games in your browser. Powerful, performant & highly capable.
OK, it works !
Shared here if it may be useful to anyone.
Thanks for your help !