Log In  

Cart #36891 | 2017-01-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6


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:

P#36894 2017-01-30 01:24 ( Edited 2017-12-22 00:28)

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.

P#36902 2017-01-30 10:49 ( Edited 2017-01-30 15:49)

Just need a dot matrix printer sound now =)

P#36914 2017-01-30 15:00 ( Edited 2017-01-30 20:00)

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.

P#36964 2017-01-31 08:56 ( Edited 2017-01-31 13:56)

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? :)

P#47597 2017-12-21 19:28 ( Edited 2017-12-22 00:28)

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-03-28 18:22:41 | 0.026s | Q:19