Skip to content

Instantly share code, notes, and snippets.

@Powersaurus
Powersaurus / bears-comments.p8
Created September 21, 2022 22:19
BEARS STOLE YOUR PICNIC, but with comments
-- set nearly my "usual" palette, ready for drawing the sprites
cls()pal(split"1,141,3,4,5,6,7,137,9,10,138,12,13,131,133",1)
-- draw 4 trees, 4 items and a bear. A lot of overdraw here, the 150
-- is chosen because it is a number I duplicate later to appease
-- the compressor, and because it ensures scattering foliage
-- gives the impression of a bushy tree
for i=0,150do
-- draw the trunks using a mix of symbols and p8scii control codes
-- every sprite is created by using the ? print shorthand to draw
-- to the screen
@Powersaurus
Powersaurus / bears.p8
Created September 20, 2022 22:56
BEARS STOLE YOUR PICNIC
cls()pal(split"1,141,3,4,5,6,7,137,9,10,138,12,13,131,133",1)
for i=0,150do
?"\^t\f5✽\-6\ff ✽\b\^w\f1\|e𝘷",rnd(i%5)+i%4*32+8,24+i/9
y=rnd(26)
?"\^t\f3★\-b★\b\fe░\-9\f1ˇ",i%4*32+rnd(y)+6-y/4,y
?"\f3●\b\|f\fb●\b /\f8█\b\f9ˇ\fb█\b\f7⧗\f4█\fa\-9▒\f4\-a█\f1█1\b\b\b\f4m🐱",1,54
end
memcpy(0,0x6000,0x2000)
::x::t,h,j,c,n,a,m,l={},8,8,0,0,0,split"apple,crisps,lemonade,sandwich"
for i=0,80do
@Powersaurus
Powersaurus / main.lua
Created August 5, 2022 14:54
PICO-8 Palette shader in Love2D
palette_swap_shader = [[
extern vec4 colours_lookup[16];
extern vec4 screen_colours[16];
extern int transparent_colour = 0;
vec4 transparent = vec4(0,0,0,0);
vec4 effect(vec4 color, Image tex, vec2 texture_coords, vec2 screen_coords) {
vec4 texcolour = Texel(tex, texture_coords);
@Powersaurus
Powersaurus / dotzzz.p8
Created June 11, 2021 14:44
Slowly working my way towards perspective correct 3D dots - references https://lodev.org/cgtutor/raycasting3.html
function init_palette()
--pal()
pal(2,141,1)
pal(7,135,1)
pal(8,137,1)
pal(10,140,1)
pal(11,138,1)
pal(12,134,1)
pal(14,131,1)
@Powersaurus
Powersaurus / diamond.p8
Created January 8, 2021 22:53
Diamond Squared algorithm in #pico8
-- not actually a cart, but paste it into the pico-8 code section
-- diamond squared implementation
-- by ben jones/@powersaurus
-- based on this wikipedia image https://en.wikipedia.org/wiki/diamond-square_algorithm#/media/file:diamond_square.svg
-- https://en.wikipedia.org/wiki/diamond-square_algorithm
-- it is probably wrong. looks nice though
function _init()
printh("\n ███████████████")
printh(" █new board!!!!█")
printh(" ███████████████")
@Powersaurus
Powersaurus / rayzzz-0.5.p8
Created June 27, 2020 12:42
Caped Feline Arena June '20 build
pico-8 cartridge // http://www.pico-8.com
version 27
__lua__
-- caped feline arena
-- raycaster demo
-- by @powersaurus
-- based heavily on http://lodev.org/cgtutor/raycasting.html
-- and http://lodev.org/cgtutor/raycasting2.html
-- and inspired by the work of @matthughson
-- Heap sort by @CasualEffects
@Powersaurus
Powersaurus / hello_w.pas
Last active May 1, 2020 15:23
Hello World Pascal Program + A bit of a roguelike
program helloPascal;
uses crt;
type
Room = record
x: Integer;
y: Integer;
w: Integer;
h: Integer;
end;
@Powersaurus
Powersaurus / tline-perspective-demo.p8
Last active April 25, 2020 15:14
PICO-8 tline() perspective demo
pico-8 cartridge // http://www.pico-8.com
version 21
__lua__
-- basic perspective tline demo by @powersaurus
-- player rotation
a=0
-- player screen pos
px=64
py=64
@Powersaurus
Powersaurus / tline-rotatation-demo.p8
Created April 19, 2020 13:39
Pico-8 tline rotated map demo
pico-8 cartridge // http://www.pico-8.com
version 19
__lua__
-- basic tline demo by @powersaurus
-- player rotation
a=270/360
-- player screen pos
px=64
py=64
@Powersaurus
Powersaurus / rayzzz-0.4.p8
Created September 9, 2019 22:06
Ray caster demo in PICO-8, now with fancier walls
pico-8 cartridge // http://www.pico-8.com
version 18
__lua__
-- raycaster demo
-- by @powersaurus
-- based heavily on http://lodev.org/cgtutor/raycasting.html
-- and http://lodev.org/cgtutor/raycasting2.html
-- and inspired by the work of @matthughson
-- thanks for advice from @kometbomb and @doyousketch2