Log In  



Seems like a common request for functions to convert to and from char codes.
Time will show whether it shall be added to the program, but until then you can do it by yourself:

Initialization (59 tokens, 197 bytes):

chars=" !\"#$%&'()*+,-./0123456789:;<=>[email protected][\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
-- '
for i=1,95 do

(the blank comment is there solely to keep the editor from glitching out due to lack of escape sequence support)
After this is executed, you'll find yourself with having two tables - s2c, holding char->code pairs, and c2s, holding code->char pairs.
Since using these directly can be slightly less comfortable, here are a couple helper functions:

chr(code) : Returns the char (string) for the given code [13tk\36b]:

function chr(i)
 return c2s[i]

Example: chr(33) == "!"

ord(string, pos) : Returns the code for the character at the given position (optional argument) in a string [26tk\57b]:

function ord(s,i)
 return s2c[sub(s,i or 1,i or 1)]

Example: ord("Hello!", 6) == 33

chrs(...codes) : Forms a string from one or more codes [50tk\103b]

function chrs(...)
 local t={...}
 local r=""
 for i=1,#t do
 return r

Example: chrs(104,105,33) == "hi!"

Additional notes:

  1. If you are in a dire need, you can shorten the chars-string to only include the uppercase letters.
  2. Depending on situation, you may also want this to handle linebreak via

Then you can use the multiline string format [[ text ]]... which currently isn't considered as a string for token count though.

Have fun!

P#13722 2015-09-05 14:26 ( Edited 2015-09-06 18:27)

Cart [#12468#] | Code | 2015-08-08 | No License | Embed

Can be combined with global palette to create objects that can only be seen in close promixity.
Somewhat bearable performance-wise.
Haxe source: https://gist.github.com/anonymous/c885964ca61431a8e90a

P#12469 2015-08-08 09:18 ( Edited 2015-08-08 13:18)

Blog post: http://yal.cc/introducing-hxpico8/
Repository: https://github.com/YellowAfterlife/hxpico8
Examples: https://github.com/YellowAfterlife/hxpico8xm

In short, this project permits to use Haxe programming language to create programs for PICO-8 (by transpiling Haxe into PICO-8's flavour of Lua).
This grants you classes, compile-time optimizations, constant and function inlining, and a whole bunch of other "syntactic sugar" features while keeping the output size reasonably small.
For example, this class compiles to this .p8.
Obviously, you can do more complex things with it too.

Have fun :)

P#12245 2015-08-04 04:09 ( Edited 2015-08-04 08:57)

Cart [#12242#] | Code | 2015-08-04 | No License | Embed

This is a small demo that I've been showing on Twitter/Tumblr yesterday. Currently there isn't much going on other than concept demonstration (and most of "engine" code needed). The code is laid out to allow taking it in various directions from here.
Source code

P#12244 2015-08-04 04:07 ( Edited 2016-12-14 01:33)

Seeing screenshots of 3d[-ish] games here and there, a question arises - how does one draw filled triangles, and does so efficiently? I have tried porting one-before-last-step algorithm from here:
which resulted in this little monstrous function:
but, alas, the math is just too much - it can barely draw half of screen worth of triangles before CPU use reaches 1.0. And that's before there's even any game!
I'd appreciate some pointers towards algorithms more suitable for pico-8. Or any help, really.

P#11928 2015-07-27 18:20 ( Edited 2015-09-20 19:28)

Cart [#11747#] | Code | 2015-07-21 | No License | Embed

If you want to be able to change text color halfway through without splitting into multiple commands, here's just that at a price of 150 tokens / 265 compressed chars.
So doing
printc("hello ^8world^7!", 4, 4)
will output

Could have been a bit smaller if there were functions to convert string to/from charcode.

P#11746 2015-07-21 18:40 ( Edited 2017-10-10 20:34)

Cart [#10855#] | Code | 2015-05-22 | No License | Embed

Update: Actually, why not go a bit further, and create a code viewer. Includes a custom font by me.

Cart [#10853#] | Code | 2015-05-22 | No License | Embed

A quine is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.

This achieved by having the program modify it's own source and re-launch via the "run" command.
Essentially it does this:

(original program source here)
P#10854 2015-05-22 04:27 ( Edited 2015-05-27 18:59)

It would make sense if dragging a .p8/.p8.png onto pico-8 ("pico8 file_path") would cause it to cd to the containing directory, load the cart, and run it. In particular, this would allow to associate pico-8 with the .p8 format and/or start it from external applications (e.g. to use Notepad++/Sublime Text for editing code and have a key to launch pico-8 with the current file loaded).

P#10476 2015-05-05 03:03 ( Edited 2015-05-05 09:35)

Cart [#10437#] | Code | 2015-05-03 | No License | Embed

Stories at the dawn is a short minimalistic platformer game that I've made over the weekend.
There is a [small] world to explore and multiple endings to uncover.

The game is currently silent as I currently do not have enough experience to create anyhow worthy audio. If you feel like you can do something about that, feel free to message me or tinker with the game file (I have tried to add sufficient amounts of comments).

If you liked the game, you can also support it via the itch.io page.

P#10439 2015-05-03 14:18 ( Edited 2015-07-03 03:36)

Web: https://dl.dropboxusercontent.com/u/3594143/yal.cc/r/picodoc/index.html

I've made a small cheat sheet/API reference thing for pico-8's standard functions.
It provides a list of names+arguments, and you can click to expand/collapse sections/function descriptions:

Generally intended to greatly reduce the amount of scrolling back and forth while looking things up.

P#10386 2015-04-30 16:03 ( Edited 2015-12-24 14:21)

Cart [#10310#] | Code | 2015-04-29 | No License | Embed

A pretty standard Tetris example.
Scoring, colors, soft drops, wallkicks.
Contains some comments on the process.
No audio as I have not figured that out so far.

P#10311 2015-04-29 10:27 ( Edited 2015-04-29 14:27)

About | Contact | Updates | Terms of Use
Follow Lexaloffle:        
Generated 2019-08-17 21:24 | 0.110s | 4194k | Q:87