I'm sure this is probably an easy answer, but why do these work differently, where co_anim1 resets to nil after completion, but co_anim2 does not?
function _init() co_anim1=cocreate(animate) co_anim2=cocreate(animate) end function _draw() cls() --first method if (co_anim1 and costatus(co_anim1)!="dead") then coresume(co_anim1) else co_anim1=nil end --second method, same as first, --but sent to a function to do --the work. resume(co_anim2) print("co_anim1:",0,0,5) print(co_anim1,36,0,7) if (co_anim1) print(costatus(co_anim1),75,0,7) print("co_anim2:",0,6,5) print(co_anim2,36,6,7) if (co_anim1) print(costatus(co_anim1),75,6,7) end function resume(co) if (co and costatus(co)!="dead") then coresume(co) else co=nil end end function animate() local a=rnd() for i=1,40 do circ(64+cos(a)*i,64+sin(a)*i,4,7) yield() end end
This code results in this behavior:
I use Dropbox to share my PICO-8 carts, screenshots, and gifs between my desktops and laptop. It's extremely useful to use it that way. It means all my carts in are one place, they're all saved to the cloud, and I never have to worry about which carts are on which device. (Another bonus is that I only have to update PICO-8 in one place, Dropbox, when a new version comes out.)
The TL;DR is just installing PICO-8 in a folder in Dropbox, and then tweaking the config file on each device to make sure it uses the Dropbox folder as where stores the carts and images (screenshots and gifs).
I know there are probably tweaks that could be done to this guide for each person's individual setup, and maybe there are ways to improve what I have set up here, but this has worked for me for half a decade, so.... ¯\_(ツ)_/¯ Also, I primarily use Windows machines, so this setup may need tweaking to make this kind of setup work on MacOS or Linux. (It should be effectively the same process, though.)
Here are the steps I use:
1) I install PICO-8 into a folder on Dropbox. I'll call that folder D:\Dropbox\pico8 for simplicity. (My actual path to PICO-8 in Dropbox is way longer, has spaces, etc.)
2) I run PICO-8 from that folder so that it creates the appropriate files and folders in my AppData folder at C:\Users\Dylan\AppData\Roaming\pico-8
3) I create a carts and images folder in D:\Dropbox\pico8
4) I create a symbolic link folder for both carts and images in the root of my C:\ drive by opening up a Command Prompt window and typing the following:
cd c:\ mklink /d pico8-carts d:\dropbox\pico8\carts mklink /d pico8-images d:\dropbox\pico8\images
This step requires some explanation, and this step might not be necessary for you, but I do it because my full Dropbox folder path has spaces in it and that seems to not work with PICO-8's config file settings.
A symbolic link is a like a fake folder that points to a real folder. So I'm effectively making a fake c:\pico8-carts folder that, when you open it, actually goes to D:\Dropbox\pico8\carts instead.
5) Now I edit my PICO-8 config.txt file to use these new folders. Specifically, I ensure that these settings are set in the config.txt file:
// Location of pico-8's root folder root_path c:\pico8-carts // Desktop for saving screenshots etc. Defaults to $HOME/Desktop desktop_path c:\pico8-images\
If the settings aren't already in your config.txt file, go ahead and add them. (The lines that start with // are just comments and can be ignored if they aren't there or are different.)
This makes sure that PICO-8 is looking at the "fake" folders created with mklink above for saving carts and screenshots/gifs. While PICO-8 thinks they are being saved to c:\pico8-carts and c:\pico8-images, they are actually being saved into my Dropbox folder.
I then do steps 2-5 on each device. Now, when I save or load a cart, or I save a screenshot or gif, it goes to Dropbox instead and everything stays in sync.
I'm happy to answer questions on this process, and if you have suggestions for improving it or changing it, feel free to comment below. Like I said above, there are probably many ways of simplifying this process or making it cleaner (like using command line arguments instead of changing the config.txt, for example) but this works for me and I thought others might benefit from its use.
Remember the classic Shockwave Flash snowball fight game called Snowcraft from 1998? 21 years ago! My entry for this year's PICO-8 Advent Calendar is a demake of that beloved Flash game. Huge thanks to @Gruber for helping with the sound effects!
This game uses the mouse. (Sorry, mobile users!)
I tried to make this as close to the original as possible. Have fun! :)
❎ to show CPU usage (but I don't think it's accurate?)
🅾️ to show the follow target
This is a quick port of my PICO-8 boids cart. Nothing fancy, just some boids doing their thing.
❎ to show the follow target
🅾️ to show CPU usage
Feel free to pick apart the code. Unfortunately, it's not commented much, and I'm absolutely sure there are optimizations that can be done.
This is a heavily commented cart that shows one way of doing flowing dialog text with coroutines. If you have any questions on how it works, feel free to ask. Again, this is one way of doing it. :)
I just finished creating a tutorial for making a top-down adventure game in PICO-8. It's 10 relatively short videos (45 minutes for all 10 videos). You don't need any prior experience with PICO-8 to do the tutorial. I have done this tutorial with many, many kids and the games they create with it are always inspiring.
UPDATE 8/25: I've added a bonus step that allows you to add text to your game! :D
UPDATE 8/27: I added another bonus step that allows you have as many types of tiles as you want. You could use them for treasure, special keys to specific doors, teleporters, quest items, anything you want! 🗝️📜
You can find it on itch.io and on YouTube:
If you have any questions or need any help, feel free to let me know. I hope you enjoy it! :)
My Happy Challah Days entry for the 2018 PICO-8 Advent Calendar was created using this tutorial as the base code. (I added extra features for the jam, like dialog boxes, quests, and a larger inventory, but its foundation is this tutorial.)
This was a slide deck I made for a mini workshop I gave on arcade mechanics at a PIGSquad Summer Slow Jams event last night. (Following in the footsteps of @nextlevelbanana, I used a Nintendo controller as a clicker. 😄) Feel free to use the code for your own presentations.
This is a VERY simple game for very young kids to edit. This was literally coded in an hour, so it's not optimized or super clean code or anything like that. It just works and is easy for kids to edit. :) It's intended for kids to edit the sprites, sounds, and game variables.
WHAT TO EDIT
Player - Sprite 1 and 2 are the player sprite.
Pickups - There are two rows of pickups. The top row gets only little_points if they are picked up. The bottom row gets big_points if they are picked up.
Baddies - These are sprites 49 and 50 (bottom-left of sprite tab 0).
Stars - The 4 pixels in sprite 48 (bottom-left) define the star colors.
Sound 0 - When a top row pickup gets picked up.
Sound 1 - When a bottom row pickup gets picked up.
Sound 2 - When the player hits a baddie.
little_points - Points gotten from picking up a top-row pickup.
big_points - Points gotten from picking up a bottom-row pickup.
game_speed - How fast the overall game should go.
player_speed - How fast the player moves.
animation_speed - How fast the animations change.
seconds_between_pickups - Self-explanatory.
seconds_between_baddies - Self-explanatory.
sky_color - Self-explanatory.
number_of_stars - Self-explanatory.
@zep, I've been really curious about the water feature in Voxatron. I love how it looks and how it acts. It just looks and feels so satisfying. But I've had just a hell of a time finding good articles that give me any sort of clue on how to recreate it with any sort of decent performance. (Or even to look as good as yours.) There's the classic water ripple algorithm that so many articles refer back to. But running that on 128^2 voxels just kills performance. Any clues as to what direction to look in to do water the way you do it in Voxatron? Is it something that works well because it's done "natively", so to speak, but wouldn't necessarily work well within the Lua performance constraints of the custom scripting feature?
A very simple tweetcart, but with the code expanded to make it easier to understand what's happening. Enjoy!
A small exploration game about a little being who has crash landed on a planet and needs to find how to get home. You find some waystones that look promising. If you could only find a way to activate them, maybe they'd help....
(Please know that this is game jam code, which means it's horrendous.)
EDIT: Added the insides of trees so they look cool when they clip off the edge of the screen, and also a label image.
I don't know if this is a bug or a debug feature? But when pressing the number 6 while in the designer, it zooms in super huge on the mouse. This is really distracting when coding because it'll flash up huge on the screen if you happen to hit a 6 while you type! 😆 Maybe an option to disable that feature while editing code?
@zep, I had a few questions about the config.txt settings. I tried searching through old posts, but couldn't find anything, so I thought I'd ask here. Most of the things I could figure out just from knowing what they do in PICO-8. But a few were still mysteries.
Trying to figure out why the player looks so jittery. I'm having the camera follow the player, and the ground below looks fine as the player moves, but the player itself is super jittery. In the embedded player here it looks fine, but while running in the designer, it's super jittery.
View Older Posts