This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--The state of the vine is represented by x, y and a. | |
--x,y is the center of the base of the vine. | |
--a is the angle the vine is facing. It will always be a multiple of 1/4. | |
--(PICO-8 angles are 0..1) | |
--Each part of the vine is 10x10 pixels. | |
x=0 | |
y=60 | |
a=0 | |
--We only need to clear the screen once. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
::_:: | |
cls() | |
--Iterate 6 jellies. The 0th one will be invisible, but we need it for pal(). | |
for n=0,6 do | |
--The x position of the Jelly. | |
x=n*288%112 | |
--Scale of the jelly, from 0..1. | |
k=n/6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- A note about faking toruses: | |
-- Spheres under projection become circles. | |
-- If we treat a torus like a chain of overlapping spheres, then we can draw | |
-- it using just circfill :) | |
::_:: | |
cls(1) | |
-- The camera rotation angle. | |
q=t()/6 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- gumtree.lua | |
-- pico-8 3d/voxel library | |
-- | |
-- coordinates: x,y = ground; z = vertical | |
-- | |
-- how it works: | |
-- to make sure shapes in the right order, we need to sort them from back to front. | |
-- to do this shapes are drawn only once the scene has been populated. | |
-- we represent shapes as tables, created using gumtree functions. | |
-- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- gumtree.lua | |
-- coordinates: x,y = ground; z = vertical | |
-- camera | |
local gt_cam={ | |
x=0, | |
y=0, | |
z=0, | |
-- spin angle | |
s=0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- In RGB displays, each pixel contains 3 subpixels for red, green and blue. | |
-- The intensity of each subpixel can be changed independently. | |
-- Mixing different intensities of each allows for a large range of colors. | |
-- In this program, we'll use a similar approach. | |
-- Except our RGB subpixels can only be on or off, which limits us to 8 colors. | |
-- We can treat a PICO-8 color index like an RGB pixel by treating the first 3 | |
-- bits as flags for each RGB subpixel. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--This code uses the following RGB trick | |
--https://gist.github.com/lucatronica/6dc7fae058440ab208d99584fe314e5c | |
--Setting up the RGB colors. | |
--Unlike the above example, we're using all 16 colors now! | |
--That's because we're now using the 4th bit of the color index. | |
--We use this bit (color 8) for the background text color. | |
pal({ | |
8,11,10,140,14,12,7, | |
129,8,11,10,140,14,12,7, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Set the background color. | |
pal(0,140,1) | |
function _update60() | |
cls() | |
--Two iterations | |
-- 0: Splashes | |
-- 1: Rain | |
for j=0,1 do |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _draw() | |
cls(8) | |
srand(5) | |
-- Iterate every 8 square pixels of the screen. | |
-- The `.5` is to make sure the points are at the center of each pixel. | |
-- We'll draw one wall of the maze in each square. | |
for y=.5,129,8 do | |
for x=.5,129,8 do | |
-- Progress in the rotation cycle. One rotation is [0..1] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pal({130,2,136,8,142,135},1) | |
function _draw() | |
cls(5) | |
srand(0x2152) | |
local f=t() | |
--sun | |
circfill(110,18,4,6) | |
OlderNewer