controls: press x
a demake of tempres by tak, the best puzzle game of all time.
source code in 257 characters.
Normally, replacing text and then undoing works great – the undo will immediately change it back to how it was before replacing, as expected.
However, replacing the first character in the cart acts a little differently (but not drastically): If you highlight the first character, replace it, and then press undo, it will first go back to a state where neither the replaced text or the replacement text is present (unlike when you undo replacements elsewhere in the file). If you undo one more time, the originally replaced text will be back, as expected.
Worse, though: If you replace all the text in the cart and then undo, nothing will be undone, and the both the replaced and the replacement text is gone.
How to reproduce:
- Write some text in the code editor
- Highlight all the text (for example with CTRL+A)
- Write some new text, replacing the highlighted text (or paste something in with CTRL+V)
- Try to undo the replacement with CTRL+Z
People have made mockups of how a "real" PICO-8 console and controller could look... But what about the devkit keyboard?
- Small, compact keyboard layout, like 75%, 65% or 60%
- Mechanical clicky switches
- Retro keycap profile (ADA?)
- Iconic PICO-8 font and colors on the keycaps
Here's a quick 75%-ish mockup I made (in ISO-NO since that's what I use, but a real one would probably be ANSI or JIS?). It's pretty busy, printing is WIP, and it's probably a bit too big; I added the F key row to try out symbols for GIF recording and stuff.
Group buy when?
This isn't exactly a bug, but an aspect of the API that bothers me a bit.
In PICO-8:
add(table, element) -- returns the added element del(table, element) -- returns nil |
This doesn't make much sense to me. Returning the added element is a nice convenience, since it allows you to do things like creating multidimensional tables succintly:
for x=1, width do local col = add(table, {}) for y=1, height do add(col, {}) end end |
But returning nil when deleting an element does not make sense to me. If it returned the deleted element, it would be possible to know whether an element was found or not, without first checking for membership.
For comparison, this is how it is in Lua:
table.insert(table, element) -- returns nil table.remove(table, position) -- returns the removed element |
This is a fun bug, but not exactly a big deal. I'm not sure if it has been reported before.
If you delete any amount of text at the end of a cartridge, you can retrieve it by pressing the DELETE key while your cursor is at the end of the file (as long as the buffer is not empty).
Simplest way to reproduce: Write something in the PICO-8 code editor, and then delete everything. Write something (one character will do) and then press DELETE. Voila!
Hey, I'm trying to figure out why btnp(x) seems to be true for one frame after stat(31)=="x" is true in devkit mode, or if I'm doing something dumb.
Here's an example cart. Press X, and it will show display the number of the frame that it registered the devkit keypress and the X button press respectively. There seems to be one frame difference.
My actual usecase is this: I have a password input in a game where I want to record numerical input from the devkit keyboard, but I also want it to record the X button, which confirms the password. Unfortunately, the 8 key is mapped to the X button; when they're also recorded on different frames it becomes a little convoluted to separate the two.
Just a small snippet from a token-saving discussion on the Discord last night.
If you need to iterate over neighboring tiles (for example when writing a path finding algorithm for 7DRL), this natural approach is pretty token heavy:
-- four directions, 29 tokens for direction in all{{-1,0},{0,-1},{1,0},{0,1}} do local x,y=direction[1],direction[2] end -- eight directions, 45 tokens for direction in all{{-1,0},{0,-1},{1,0},{0,1},{1,1},{-1,-1},{1,-1},{-1,1}} do local x,y=direction[1],direction[2] end -- eight directions, 43 tokens directions={0,-1,-1,0,1,0,0,1,1,-1,-1,1,1,1,-1,-1} for i=1,16,2 do local x,y=directions[i],directions[i+1] end -- eight directions, 30 tokens directions={-1,0,1} for x in all(directions) do for y in all(directions) do if x!=0 or y!=0 then -- end end end |
Why not use trigonometry?
-- four directions, 16 tokens for i=0,1,0.25 do [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=62065#p) |
A demake of my game Patrick's Cyberpunk Challenge for the TweetTweetJam.
The object of the game is to move Patrick the Leprechaun around the board and remove all 28 squares. Squares with special symbols will remove extra squares:
Move Patrick to a square using the arrow keys. Note that you can (and sometimes must) move diagonally by pressing two arrow keys simultaneously.
Puzzles might be impossible to solve, and the game doesn't recognize if you win or lose. If the screen is empty except for Patrick, you win! If you have no legal moves, you lose and must restart the game manually.
Here's a strange bug I found. If you write something like this in the code editor:
rectfill(0,0,5,5) |
and you search for 0 with CTRL+F, it will highlight the first 0. If you then press CTRL+G, however, it will fail to find the second one. The same goes for the 5.
From my testing, this seems to only happen with every other occurence. If you search for 0 here:
rectfill(0,0,0,0) |
then CTRL+G will only highlight the first and the third argument.
I've only had it happen with function arguments, and only with single-character arguments; single-letter variable names also have this problem. Putting a space after the commas also makes it behave properly.
It's a bit of a problem when writing tweetcarts where you have little whitespace, short variable names, and want to find variables or number literals to replace while optimizing :)
There seem to be some bugs with the parsing of an escaped backslash:
So, two issues:
- The syntax highlighter doesn't stop parsing the line as a string if it encounters two backslashes in a row, although it will run without problems
- ...except when used as an argument to the ? shorthand function, which will give an error
It's not in the screenshot, but if there are any trailing characters after the double backslash, the syntax highlighter will be happy again.
I watched @zep talk about PICO-8 and cozy design spaces again today, and it really resonates with me. I work as a developer, and I really hate all the cruft we have to deal with. Like the web! God, I hate the web and what it has turned into.
I really like stuff like Zen of Python, programming aphorisms, principles like DRY, POLA, KISS, etc. I watched through the video and tried to write down some nuggets of wisdom. Apologies to @zep if he feels misrepresented in any of these quotes.
Manifesto
- Small things matter
- Discard and move on (the "license to abandon")
- Inhabit boundaries
- Follow a new path
- Ignore the real world
- Work in a cosy place
The Zen of PICO-8
- When you type cls() you're not just clearing the screen, you're clearing your mind and your soul, preparing for something new.
- You're among friends.
- Value design over content.
The classic Lights Out puzzle game for the TweetTweetJam. The source code fits in two tweets (560 characters).
Your goal is to turn all the lights off. However, each light toggles all four adjacent lights as well.
I didn't have room for different levels, but there's two modes:
- Lights Out Classic: Lights toggle between off and on (red). Best solution is 15 moves.
- Lights Out 2000: Lights toggle between off, red and green. Best solution is 18 moves.
This is a small game based on the Famicase "Meteor Night" for the "Chill"-themed A Game By Its Cover jam 2018. (itch.io page here)
Instructions
There's a meteor shower coming, and you take your friend or date stargazing after dark. They've never gone stargazing before, so you'll have to point out any meteors you see to your friend or date.
It's chilly outside, so make sure you keep your friend or date warm. If they see a beautiful meteor, they will forget the cold for a little while; if they keep missing meteors you point out, they'll grow frustrated and cold.