Hello !
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 ?
dropbox.com/s/61tfvg3y1b8faby/ScrollText.c3p
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 ?
dropbox.com/s/gek2kmt9a9cap69/scrolltextspritefont.c3p
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
Develop games in your browser. Powerful, performant & highly capable.
Lovely !
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.
OK, it works !
Shared here if it may be useful to anyone.
dropbox.com/s/gek2kmt9a9cap69/ScrollTextSpriteFont.c3p
Thanks for your help !