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
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.
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.
Log in to post a comment