Today I am starting a new tutorial series on how to make a Roguelike in Pico-8. New episodes will be released throughout February. Hopefully, we will be done before the 7-Day Roguelike Challenge 2019 begins. The series is designed to give you the skills and tools to participate in that challenge.
If you have any questions of feedback you can post them in this thread.
Here are the videos:
A difficult platforming game with a gardening/Splatoon-like twist. Made by Charlie Tran
This is one of my first games, and my longest to date. Please let me know what you think, thanks!
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 :)
Originally from Tobiasvl's tweetcart: https://twitter.com/Spug/status/1090559155436511232
(Sorry I didn't include the link before.)
WIP version of a little roguelike I'm working on.
Sprites are based on Scroll-o-Sprites by Quale-Art.
You are THE BOY and you have entered the DIRE DUNGEON in search of treasure and glory!
Currently, v0.1 only features character and camera movement.
this nifty code lets you debug your project. Features it provides are in the codes guide on how to use it~
--super debug v 1.0 --shooting★ --[[ ………………………………………… how-to use ………………………………………… to use this code, check out tab 2 and copy the compressed code. once its coppied, you'll need to put "sdbg()" (without quotes) inside of your _draw() function, at the very bottom. make sure its drawn last. by default, the key to display debug info is the tilde key ( the ` next to the number 1 on standard u.s keyboards). you can change this by simply changing dbg_dbtn. at your init, you can put dbg_dbtn = 't' for example, and then 't' on your keyboard will open the debug info. if you want to adjust the memory location, you can adjust the variable called addr. by default, its 0x5e00. to edit it, do the same as editing dbg_dbtn, just put it in _init(). ( addr = 0x5e01 ) ………………………………………… ★features★ ………………………………………… this code displays the following information: ◆ framerate (top-right) ……… ◆ cpu usage ……… ◆ mem usage/max mem ……… ◆ test count (how many times you tested your project since installing this code) ……… ◆ mouse info (location, click #) ……… ◆ tile flags & id (displays all 8 flags on the tile you're hovering over) ……… ◆ color of hovering-pixel (gets the color of the pixel you're currently hovering the mouse over.) ……… ◆pico version ……… ◆ uptime (how long the test has been running for) ……… ]] |
Alternatively, you can copy the compressed code directly and just follow instructions from the code displayed above. here's the compressed code that makes the entire thing run.
--code dbg_dbtn = '`' dbt = 7 don = false cc = 8 mc = 15 addr = 0x5e00 function dtxt(txt,x,y,c) print(txt, x,y+1,1) print(txt,x,y,c) end function init_dbg() poke(0x5f2d, 1) test_num = peek(∧addr) or 0 poke(∧addr, test_num+1) end dbtm = 0 dbu = {0,0,0} function sdbg() if stat(31) == dbg_dbtn then if don==false then don=true else don=false end end if don != true then return end local c=dbt local cpu=stat(1)*100 local mem=(stat(0)/100)/10*32 local fps=stat(7) local u=stat(7)..'' local _x=124-(#u*4) local du = {dbu [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=61379#p) |
I know pcall isn't part of pico 8, which means you can't do regular Lua exception handling. I noticed though that coroutines swallow errors, and can return the error message. So I leveraged that to create a C#/Java style try catch finally function.
function try(t,c,f) local co=cocreate(t) local s,m=true while s and costatus(co)!="dead" do s,m=coresume(co) if not s then c(m) end end if f then f() end end cls() try(function() print("hi ") --print("hi " .. nil) end, function(e) print("an error occurred:\n"..e) end, function() print("finally") end) |
To use just use it like above. The finally function is optional, so most people will probably use it like this:
try(function() -- code end, function(e) -- exception handler end) |
Enjoy, and if you like it feel free to kick a buck to