by shanecelis
Library
This is a library to simulate physics using the eXtended Position Based Dynamics (XPBD) methodology.
xpbd.p8
- page 0, library - 1368 tokens
- page 1, demo - 698 tokens
Demo
It contains the following demos you can access with the left and right keys:
- a single bead on a ring;
- multiple beads on a ring;
- a squishy square;
- and an about page with particles.
The bead examples are ports of Matthias Muller's [ten minute physics][10min] examples.
Usage
Include the first page for the library contents without any demo code.
#include xpbd.p8:0 function _init() local a = particle:new { pos = vec(64, 64) } } local b = particle:new { pos = vec(74, 64) } } [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=136950#p) |
keyboard-lemons.p8
- page 1, library - 181 tokens
- page 2, demo - 301 tokens
This cart is principally a library for interacting with the user in a query and response format using the keyboard.
Usage
You can include the library in your own cart by including only the first page:
#include keyboard-lemons.p8:1 |
The second page includes a demo with an old kids' game called lemons. The most salient feature is that user queries can be written straightfowardly:
answer = prompt("what's 2+2? ") |
The magic—as it often does—lies in a little thing called coroutines.
Demo
This is actually one of the first computer games I ever wrote, back then in gw-basic. It was a silly
I've started to dip my toe into thinking about token minimization. Now I write most of my code in Emacs' pico8-mode, which I love since it presents the code in the same font as pico-8 so I don't feel I've strayed too far.
But I've been aching for a way to count tokens outside of pico8's editor. I found the p8tool which can do that and more, so I wrote this elisp function to make it accessible for me within Emacs.
(defun pico8-token-count (beginning end) "Calculate the number of pico-8 tokens in the file or region." (interactive "r") (let ((path (if (use-region-p) (let ((temp-file (make-temp-file "token-count-" nil ".p8"))) (write-region "pico-8 cartridge // http://www.pico-8.com\nversion 5\n__lua__\n" nil temp-file) (write-region beginning end temp-file t) [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=136058#p) |
This is the tinytest library for pico-8; it was inspired by the tinytest javascript library by Joe Walnes. It provides a basic unit test framework.
You can use it one of two ways: as a no frills library or as a singing, dancing cart.
Library Usage
You will enjoy colored text reports but otherwise no frills, but it's very flexible this way.
#include tinytest.p8 tinytest:new():run({ demo_pass = function(t) t:ok(true, "hi") end, demo_fail = function(t) t:ok(false, "bye") end, demo_error = function(t) [ [size=16][color=#ffaabb] [ Continue Reading.. ] [/color][/size] ](/bbs/?pid=134089#p) |