Edit: Forgot to add, press X or Z to print!
After seeing the awesome textbox libraries on the BBS (here and here), I decided to try making one myself. I needed one for the game I am working on and because I didn't understand the code in the libraries above, I thought it would be a good opportunity to learn (as well as a way to test how to upload carts to the BBS).
This thing is nowhere as complex as the previously mentioned libraries, but it:
prints text letter by letter
wraps text
does not split words
lets you choose x,y and color of where to start printing
allows only one textbox at a time
does not limit the amount of rows
*is under 300 tokens
I think it might be useful to someone who just needs a simple letter-by-letter printing of text stored in a single string. Maybe for intros or in-between level updates.
To use it, copy everything except what's inside the _init, _update and draw functions from the cart. Paste it into yours and call tbx functions in their respective pico-8 functions for _init, _draw and _update. Then you can call textbox, with a string as a parameter (with optional x,y,col) once to start printing. Call it without any parameter to stop it.
Here is how I am using it:
Loving it! The great thing about pico8 is you can't have one size fits all libraries, because you have to watch your tokens. So now we have 3 great text libraries each with their own merits and drawbacks. Your library might be really well suited to using coroutines too. You should check it out.
Thanks @bitJericho.
I will need to eventually look into coroutines. When they first showed up, I was really new to coding. Now I feel confident enough, that with a bit of an effort I will be able to wrap my head around it!
@EatMoreCheese, man, now I want to make a dot martix printer simulator :D It would be a good exercise to delve into sound, as I haven't really touched it yet.
Wow, thanks for this!
I'm a newbie and this is totally what i was looking for.
Question though, is it possible to limit the amount of rows shown. lets say i had a large amount of text and i only wanted 5 rows shown at a time. could i limit it to only show 5 rows and continue to the next 5 rows after pressing the button again? :)
[Please log in to post a comment]