Log In  
Follow
tobiasvl

Hobby developer from Norway. I enjoy grid-based puzzle games.

SHOW MORE

Cart #tempres-0 | 2019-11-12 | Code ▽ | Embed ▽ | No License
6

controls: press x

a demake of tempres by tak, the best puzzle game of all time.

source code in 257 characters.

P#69861 2019-11-12 22:40 ( Edited 2019-11-12 22:41)

SHOW MORE

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
P#64616 2019-05-20 10:27

SHOW MORE

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?

P#64273 2019-05-09 20:49 ( Edited 2019-05-09 20:53)

SHOW MORE

This is a very very minor thing, but the two text files that come with the Windows build of PICO-8 (the manual "pico-8.txt" and "license.txt") have UNIX newlines, which means that they might be hard to read on Windows, at least if you use a "dumb" editor like Notepad or similar to read them.

P#63576 2019-04-16 14:36

SHOW MORE

When running a local cart in 0.1.12, stat(102) returns nil, instead of 0 as it did in 0.1.11g and before.

P#63435 2019-04-12 08:20

SHOW MORE

Cart #hexagon-0 | 2019-04-10 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
4

Inspired by Terry Cavanagh's game Hexagon. Tweet.

Use the left and right arrow keys to move. (Any other button press will unfortunately crash the game, but I didn't have room for error handling.)

P#63376 2019-04-10 09:13 ( Edited 2019-04-10 09:38)

SHOW MORE

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
P#62932 2019-03-21 12:37

SHOW MORE

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!

P#62444 2019-03-02 23:54

SHOW MORE

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.

Cart #zoyifizotu-0 | 2019-02-21 | Code ▽ | Embed ▽ | No License

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.

Edit: The 8 key is no longer mapped to the X button (in non-Pocket CHIP builds) as of v0.1.12.

P#62134 2019-02-21 18:58 ( Edited 2019-09-17 10:00)

SHOW MORE

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
 local x,y=cos(i),sin(i)
end

-- eight directions, 24 tokens
for i=0.125,1,0.125 do
 local x,y=flr(cos(i)+.5),flr(sin(i)+.5)
end
P#62065 2019-02-19 10:00 ( Edited 2019-02-19 10:14)

SHOW MORE

Cart #lighthouse-0 | 2019-02-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

A tweetcart I made to teach myself what sin() and cos() actually do. I never took trigonometry.

P#61430 2019-02-01 09:54 ( Edited 2019-02-01 09:56)

SHOW MORE

Cart #picochallenge-0 | 2019-02-01 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

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.

Source code:

poke(24364,3)x="웃"v="▥"h="▤"b={}for i=1,36 do b[i]=i%9<2 and""or"█"end for i in all{"⬆️","➡️",h,"⬅️","⬇️",v,x}do repeat f=1+flr(rnd(36))until b[f]!=""b[f]=i
if(i==x)p=f
end::_::t=btnp cls()for i=0,35 do
k=b[i+1]
?k,i%9*8,6*flr(i/9)+20,k==x and 11 or 7
end b[p]=""q=p
if(t(0))q-=1
if(t(1))q+=1
if(t(2))q-=9
if(t(3))q+=9
if(b[q]and#b[q]>0)p=q t=b[p]
if(t=="⬆️"or t==v)b[p-10]=""b[p-9]=""b[p-8]=""
if(t=="⬇️"or t==v)b[p+10]=""b[p+9]=""b[p+8]=""
if(t=="⬅️"or t==h)b[p-10]=""b[p-1]=""b[p+8]=""
if(t=="➡️"or t==h)b[p+10]=""b[p+1]=""b[p-8]=""
b[p]=x flip()goto _

"Unminified" source code:

--patrick's picochallenge
--by tobiasvl

--use 64x64 resolution
poke(0x5f2c,3)

--generate a blank board of
--empty █ tiles
board={}
--the board is 7x4, but we
--represent it as a one-
--dimensional table. we also
--represent it as 36 tiles, ie
--a 9x4 grid, with two columns
--of "" on each end, so ⬅️➡️▤▥
--tiles don't wrap around when
--they destroy adjacent tiles.
for i=1,36 do
  if i%9<2 then
    --first and last column
    board[i]=""
  else
    board[i]="█"
  end
end

--populate the board with tiles
--and the player's starting tile
tiles={"⬆️","➡️","▤","⬅️","⬇️","▥","웃"}
for i in all(tiles) do
  --find a random tile which is
  --not in the "invisible" outer
  --columns
  repeat
    position=1+flr(rnd(36))
  until board[position]!=""
  board[position]=i
  --remember the player
  if (i=="웃") player=position
end

--game loop
::_::
cls()

--print the board
--here's the only obfuscation i
--left in: here i loop from
--0 to 35, instead of 1 to 36,
--because then i only need to
--do i+1 once instead of i-1
--twice.
for i=0,35 do
  local tile=board[i+1]
  --the player is green
  if tile=="웃" then
    color(11)
  else
    color(7)
  end
  --properly centering the board
  --takes up too many characters
  --so just an approximation
  print(tile,i%9*8,6*flr(i/9)+20)
end

--erase the player character
--and destroy the tile
board[player]=""
--remember the player's position
new_player=player

--move the player's position if
--an arrow key is pressed
if (btnp(⬅️)) new_player-=1
if (btnp(➡️)) new_player+=1
if (btnp(⬆️)) new_player-=9
if (btnp(⬇️)) new_player+=9

--if we're still inside the
--board proper, ie the tile isn't
--nil (outside the board) or ""
--(the border columns), make
--that the new position.
if board[new_player] and board[new_player]!="" then
  player=new_player
  tile=board[player]
end

--if the player lands on one of
--the special tiles, destroy
--adjacent tiles
if tile=="⬆️" or tile=="▥" then
  --destroy three tiles above
  board[player-10]=""
  board[player-9]=""
  board[player-8]=""
end
if tile=="⬇️" or tile=="▥" then
  --destroy three tiles below
  board[player+10]=""
  board[player+9]=""
  board[player+8]=""
end
if tile=="⬅️" or tile=="▤" then
  --destroy three tiles left
  board[player-10]=""
  board[player-1]=""
  board[player+8]=""
end
if tile=="➡️" or tile=="▤" then
  --destroy three tiles right
  board[player+10]=""
  board[player+1]=""
  board[player-8]=""
end

--put the player in the new
--(or old!) position
board[player]="웃"

--loop
flip()
goto _
P#61429 2019-02-01 08:53 ( Edited 2019-02-01 08:57)

SHOW MORE

Not a big problem, but probably easy to fix.

If you're in the sprite editor and press Alt+Left to go to the code editor, the cursor will move one space to the left.

The same happens if you're in the music editor and press Alt+Right; the cursor will move to the right.

P#61418 2019-01-31 23:26

SHOW MORE

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

P#61417 2019-01-31 23:23

SHOW MORE

Cart #sunrise-0 | 2019-01-31 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6

Tweetcart, 272 chars.

Grid based on tweetcart by @electricgryphon.

P#61403 2019-01-31 18:30 ( Edited 2019-01-31 18:38)

SHOW MORE

In the code editor, if you place the cursor at the very first character in the file, the delete key does nothing.

Expected behavior: It should delete the character under the cursor.

P#61360 2019-01-30 19:19

SHOW MORE

There seem to be some bugs with the parsing of an escaped backslash:

So, two issues:

  1. 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
  2. ...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.

P#61359 2019-01-30 19:17

SHOW MORE

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.
  • Be playful.
  • Focus on what's important to you and throw away what's not important.
  • Confront cute problems.
  • Don't be afraid to do anything wrong.
  • Make something for the love of making.
  • Just make something, capture the concept, and then move on to something else.

The Zen of Zep?

And then some words of wisdom that aren't necessarily tied to PICO-8, or directed at us as PICO-8 users.

  • Software sucks. It's terrible.
  • The tools shape the work.
  • Remove the semantics.
  • No magic.
  • Avoid minification.
  • People don't know what they want.
  • Fantasy consoles are impressionist hardware.
  • The tool has the manifesto inside itself.
  • A tool sometimes invites you to make something for it.
  • Machines can be cute.
  • The thing that makes a console a console is not the hardware, it's everything else.
P#60934 2019-01-17 20:56

SHOW MORE


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.
P#59034 2018-11-15 18:15 ( Edited 2019-02-01 08:58)

SHOW MORE

Cart #meteor_night_2_0-2 | 2019-09-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

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.

Eventually, though, they'll probably want to go home. Maybe to your place?

Controls

Using a mouse is recommended for precision and speed. Don't miss the meteors!

  • Mouse / arrow keys: Look around the sky
  • Left click / X: Point out meteor

Chill/Chill Out

Press O on the title screen to toggle between Chill mode and Chill Out mode.

In the default Chill mode, your friend or date will get colder with time. Point out as many meteors as you can to get a new high score.

In Chill Out mode, it's a warm, summer night; you won't get cold, and can just chill out as long as you want to. High score is not tracked in this mode.

Credits

P#56746 2018-09-16 16:52 ( Edited 2019-09-26 10:32)

View Older Posts
Follow Lexaloffle:          
Generated 2024-03-19 10:42:22 | 0.084s | Q:60