I'm not sure if I should post this here or in the "Tutorials"-Section, but I think it better fits here:
I wanted to show a way on how to do Map-Collision, using the Flag-System in PICO8. This Function also takes care if your Sprite is wider or taller than 8 Pixels.
Basically you give a Function a few Parameters (like Position, Width & Height from the Player) and this Function checks the Flags from the Tile-Map on certain Pixels, depending on the Player-Position and it's Width/Height. You can use the Return-Value from this Function to allow or deny Player-Movement.
Before I show the "How-To use the essential Function", there's some preparation that you need to do.
For example, you have a Table called "Player" (like in a few NerdyTeacher-Tutorials) with some Variables, like:
player = {} player.x = 3 player.y = 4 -- etc. |
This needs some Addition to properly use the Collision-Function:
- "w" for the Width of the Sprites in Pixels Minus 1.
- "h" for the Height of the Sprites in Pixels Minus 1.
- "ox" for Offset-X of the Sprites (black/transparent color) until Character starts - from left.
- "oy" for Offset-Y of the Sprites (black/transparent color) until Character starts - from top.
Example for this Cart:
player = { w=3, h=13, ox=2, oy=1, } |
Why these Values? Because:
For your own Sprites, you can change these Values as you like.
After that, I can show the Function I mentioned:
is_solid(opt,f,ox,oy,flags,debug) |
This Function can be called if you want to check if a Map-Collision happened and returns TRUE
if detected, otherwise FALSE
.
A quick description of the Parameters:
opt
== a String that describes on which places should the Collision be checked. Possible Values are:full
,left
,right
,up
,down
,lup
,rup
,ldown
,rdown
f
== Usually the Player in a Table. Generally a Table that contains at least:w
,h
,ox
,oy
ox
andoy
== Offset-X and Offset-Y, that will automatically be added to the "Calculation" of the Map-Collision.- This is really useful to check a possible Player-Movement, but BEFORE the Player has moved. You can check if Player-Movement to the "ox"-/"oy"-Position are possible without Collisions. If so, move the Player to the new Location...
flags
== A Number or a sequential Table of Numbers, which represents the Flags that will be checked for the Map-Collision.- It works like this: If this Parameter has a Table like, for example
{1,2,0}
, it will check if the Tile has the Flag 1, OR the Flag 2, OR the FLAG 0 activated. If the Collision-System finds at least one Tile where at least one Flag is activated, the Function will returnTRUE
.
- It works like this: If this Parameter has a Table like, for example
debug
== Boolean. Iftrue
, it will draw red Pixels to the "Collision-Positions". Useful for Debugging and Testing.- If you do that, then you should do that inside the
_DRAW
-Function. Keep in mind that this Function doesn't block anything, it just checks the Pixels around a Sprite and reads the Tile-Flags from these.
- If you do that, then you should do that inside the
How to use it
First things first: You set up the _INIT
and initialise the Player:
function _init() player = { x=5*8, y=2*8, w=3, h=13, ox=2, oy=1, } end |
Of course, modify these Values as you like to match your own Sprites.
Inside the _DRAW
-Function, simply clear the Screen, draw the Map and the Player-Sprite:
function _draw() cls() map() spr(1, player.x, player.y) end |
If you want a Debug-Output for the Collision Detection, you can add this Line in the 2nd last Line:
is_solid("full",player,0,0,{},true) |
Inside the _UPDATE
-Function, first thing to do is check Player-Input and saving them in Variables:
function _update() local dx,dy=0,0 if(btn(⬅️))dx=-1 if(btn(➡️))dx+=1 if(btn(⬆️))dy=-1 if(btn(⬇️))dy+=1 |
After that, you can check if the new Location (that's the Location where the Player wants to move) has no Collision. If that's the case, you can simply move the Player to the new Location:
First, the X-Coordinate
if not is_solid("full",player,dx,0,7) then player.x+=dx end |
Parameters are "full"
for a "full-sprite-check" to the new Position, player
for the Player-Table, dx
for the additional Movement-Position (because we won't wanna check the "old" Player-Position for Map-Collision, we wanna check the new Location if there's a Map-Collison...). 0
is the Additional "Offset-Y". We wanna check this Value a little bit later (the Reason will be explained soon*). The last Parameter 7
(could also be {7}
) checks the Flags of the Tiles. If one Tile has the Flag "7" activated, the Function will return "TRUE", the Line after the IF-Command wouldn't be executed and the Player won't move to the new Position.
The last four Lines inside "_UPDATE" are:
if not is_solid("full",player,0,dy,7) then player.y+=dy end end |
It's basically the same as before, but now for the Y-Position.
*Maybe you have the Question "Why do we check X and Y seperately?". Because you won't completely stop the Movement if you bump into a "forbidden" Tile. For example, if you move diagonally and check the OX- and OY-Collision at the same time, the Player will instantly stop moving around. I think for the sake of "Game-feel", it's better that the Player could "Slide around" on the Tile...
Hope this Example could be useful for you. I included some additional "flavors" on the Cartridge (like Flipping the Sprite on X and Y, and drawing the Sprite in the right size depending on the previous discussed Values), but it's basically the same as the Example I described^^. Cartridge is also commented as well.
Would like to hear Feedback and Stuff. Also if you found an error (I hope there are no errors^^) please let me know. Use the Source as you like^^.
Last but not least, the whole Stuff without any comment for Copy'n Pasting:
Wish you a good day! :)
Hey there,
A Feature Request for the PICO8-Users out there which use a Handheld (like Anbernic RG351P/M/V) to play PICO8-Games:
Normally, you can start every Cartridge directly using "-run" in the Command Line:
pico8 -run some_cartridge.p8 |
On Handheld-Devices, that's great, because you can Pause and Shutdown PICO8 with the given Controls.
HOWEVER: I was able to run a Cartridge that "crashed" PICO8 (means it shows some Lua-Errors and the Program stops running). But after that Crash, PICO8 doesn't quit, instead it throws me into the Command line, like:
(example crash)

But that's not good if that happens on a Handheld, because you have no opportunity now to close PICO8 without a Keyboard (or something hacky like SSH etc.). After that, I have no other choice than Poweroff that Handheld and hoping that the Filesystem on the SD-Card don't get corrupted.
Hello there,
Krystman made an excellent Game called Porklike, you can find it here: https://www.lexaloffle.com/bbs/?pid=94445
I made a mod to this game which adds a german translation to it. Right after the Game starts, you'll be asked on which language you want to play.
I would've liked to add some more Functionality (like, a menuitem), but there wasn't enough tokens left to do so^^.
Here's the Mod:
Changelog:
Hey there,
In the 0.2.2 release, zep made a small tool for creating custom fonts:
https://www.lexaloffle.com/bbs/?tid=41544
I'd like to just slightly modify the Original-Font that provides PICO-8 by itself. I thought I could find an easy way to implement the Original-Font into the Spritesheet... But it seems there's no easy way to do so? And nobody did this before? So I decided to modify the Spritesheet, include the Original-Chars with it.
It SHOULD be the Original-Chars; if you find an error (misplaced Pixel or something like that), feel free to tell me so I can fix this :) .
--
While running PICO-8, type
import #font_orig |
to load the newest Version of the Cartridge.
EDIT: Of course, feel free to use it as you like^^.
Changelog:
Hi @ all,
I like those old "Oddworld"-Games ("Abe's Oddyssey" and "Abe's Exoddus"). Just experimenting with a "Gamespeak"-like Control:
Absolutely nothing is finished, just the Gamespeak, Collision and the Animation works. No Gameplay so far.
For Gamespeak, hold Z and
UP: "Hello"
RIGHT: "Follow Me"
DOWN: "Wait"
LEFT: "Everyone"
I really want to make an Oddworld-like Demake, but I can't promise anything^^. I'll try to work on that Project^^...
Entry for the One Hour Game Jam 297th, Theme: Follow.
A Shadow is following you, and you need to reach the Goal. Your Shadow(s) also need to reach a Goal.
Note:
It took me four Hours instead of only one to make this Cart. It would be dishonest to other Jammers if I would hide that fact^^.
I like the Idea, maybe I'll work on some more Levels and a better presentation, but I really don't know atm^^.
Have Fun!
Mea's Castle
Mea's Castle is a Metroidvania-like Game: You're a little Adventurer and your Goal is to find the "Cup of Hope". You can run and jump, and soon you will find some Artifacts that'll give you more Abilities.
🠔🠖 - Move
🠗 + 🠔🠖 - Crouch
(Z) - Jump
(X) + 🠗 - Use the last Powerup
Warning
This Game is difficult. If you're not a Fan of Jump'n Run-like Games, I think it will be too frustrating^^. There are still Checkpoints basically everywhere, but it's still not easy to beat that Game. Expect to die a lot while playing this^^.
Credits
Thanks to
- @Gruber for the Music "Eyes in the Dark" and "Flight of Icarus" (both with slight Remixes) from Pico-8 Tunes Volume 2 .
- Youtuber Dev Quest and his Video Efficient Tilesets in Pico-8 Tutorial
- @Krystman for his Cartridge "Sample Code: Screenshake and Fading" and all the other Videos and Tutorials.
- Youtuber hh7x6 and his Speedrun-Video.
- Of course: Thanks to you for playing! :)
Other stuff
Also, if you like to cheat, you can use
Also, here's the Map of the Game. Altough I'm not sure if it's that useful here^^:
Hope you'll have Fun with that little Game^^.
Enjoy!
Changelogs
I doubt that's an intended behaviour: After running a Cart that's using the "FILLP"-Command, every Draw in the Sprite-Editor that includes Pencil or Shape (the last one; not shown in the GIF) also uses this pattern:

On 0.2.1B, it's possible to use "fillp(█)" (or simply reboot) to solve that Problem...
(I was working on a Game and tried to change a Sprite, and I wondered that I suddenly couldn't overwrite some Pixels in the Sprite anymore. I was like "what the Hell is going on there?" until I discovered that^^)
Entry for the One Hour Game Jam, Theme: Leave.
Entry for OHGJ 262th. Theme: Time Travel.
I really run out of time^^.
Hey there,
according from the Wiki-Page about Memory, it is unclear what a Poke to address 0x5f5e does, right?
0x5f5e-0x5f7f / 24414-24447 The remaining registers up to 0x5f7f are undocumented. |
I was playing around a bit and found something out: It seems to "reduce" the Colors that can be used. For example, poking a "1" reduce the Palette to only 2 Colors, Black and Dark-Blue.
A simple Description: It seems that poking around 0x5f5e is some sort of "pal" all over the Color-Palette, but also prevents you to "pal" another Color. For Example: If you poke a "1", "pal" is limited to set a Color to blue or black only.
I just uploaded a Cartridge where you could play around with that:
I didn't found anything about that address in PICO-8, so I thought, it can be useful for others and like to share that^^. (I already imagine some sort of "Switch the Game from a NES-like-Palette to a GB-like-Palette", or something like that^^.)
Cheers.
Entry for the One Hour Game Jam, Theme: 4 Colors only.
Swap colors to avoid Enemies.
Very short, because I run out of time^^.
Just experiencing with an "Impossible Game"- or "Geometry Dash"-like Prototype. Basic Gameplay works, but every other Thing is unfinished at this point^^.
Hello there,
(English isn't my first Language, I hope it doesn't sound too bad, Sorry^^)
I was looking for a easy Solution to "modify" the Linux in my GPi Case to boot directly into PICO8. I don't want to use something like Retropie/Recalbox/Lakka, just a PICO8-Machine.
There was already a Project called PICOPI, which already assembled that. But it seems this Project doesn't exist anymore (Homepage is down; the Files I could find on archive.org doesn't seem to work anymore).
So I thought I write my own Script for this, which builds upon Raspbian, the Default-Linux-Distribution for Raspberry Pi (which builds upon GPi Case). I thought it could be useful for others, so I uploaded the Script^^.
While using this Script, you will be able to put your .p8-Files directly on the "boot"-Partition on the SD Card.
Script can be found on Github, including a Manual for using it:
https://github.com/Astorek86/Pico8-Script-for-GPi-Case
EDIT: I also uploaded a Video on Youtube to show the Process:
Hello,
just testing some Slopes in a Jump'n Run-like Prototype.
Nothing's really finished yet, I'm just testing around^^.
Hey everybody! Just sharing a little Minesweeper-Clone that I've programmed^^.
New Version:
Mouse is not required anymore, but you can use the Cartridge below if you wanna use the Mouse.
Controls for "Non-Mouse-Version":
- Arrow-Keys to move Cursor.
- Press and release X to open a Tile.
- Press and release O to mark a Tile (red or blue Flag).
- Hold X or O + Arrow-Keys to scroll.
And here the "Mouse-Version" of the Game:
IMPORTANT: Keep in mind that the "Mouse-Version" can be quite unplayable on Browsers. This Version of the Game runs best directly on PC, started by PICO8.
Controls for "Mouse-Version":
- Left-Click to open Field.
- Right-Click to mark Field with a red or blue Flag.
- Hold Middle-Click (or Arrow-Keys) to scroll.
- You can use O to simulate Left-Clicks, X for Right-Clicks.
Game should fully works as expected, hope I didn't forget anything^^.
A few GIFs:
Just playing on normal Difficulty:

Scrolling with Arrow-Keys and Mouse:

Showing "Custom"-Menu for own Width/Heigth/Mines:

Hope you enjoy!
Changelog:
- Mouse isn't required anymore; there are now two Cartridges: A "Non-Mouse-Version" and a "Mouse-Version".
- Added an Animation when opening a Tile.
- Added Sound when opening a few Tiles at once.
- Optimization (Tiles won't be drawed if outside the Screen)
- Every Difficulty can now be reached through Pause-Menu
One Hour Game Jam - Theme: Island (2018-09-15)
There is not much you can do here^^. Just walking around, cut trees, craft a wooden Sword and kill Monsters with it. Description reads alot better^^.
A little bit easier with less enemies:
Submit for the One Hour Game Jam 167,
http://onehourgamejam.com
Theme: That's not supposed to be a weapon.
Submit for the One Hour Game Jam
Theme: your favorite game but the most simplest possible
View Older Posts