This file contains 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
-- rspr(spritesheetX,spritesheetY, screenX,screenY, angle, tileWidth, transColor) | |
-- tileWidth is squared when look at sprites. So a tileWidth=2 will do a 2x2 tile size (16x16) at sx,sy | |
function rspr(sx,sy,x,y,a,w,trans) | |
local ca,sa=cos(a),sin(a) | |
local srcx,srcy,addr,pixel_pair | |
local ddx0,ddy0=ca,sa | |
local mask=shl(0xfff8,(w-1)) | |
w*=4 | |
ca*=w | |
sa*=w |
This file contains 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
-- | |
-- draws a sprite to the screen with an outline of the specified colour | |
-- transc is color to use as transparent; default is black (0) | |
function outline_sprite(n, col_outline,transc x,y, w,h, flip_x,flip_y) | |
transc=transc or 0 | |
-- reset palette to black | |
palt(transc,true) | |
for c=1,15 do | |
pal(c,col_outline) |
This file contains 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
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<title>PICO-8 Cartridge</title> | |
<meta name="description" content=""> | |
<STYLE TYPE="text/css"> | |
<!-- |
This file contains 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
pico-8 cartridge // http://www.pico-8.com | |
version 16 | |
__lua__ | |
-- scratch | |
function newall() | |
local obj={ | |
x=120,y=120,tail={} | |
} |
This file contains 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
--[[ | |
Put mouse.init() in the _init() | |
Put the following in the _update loop | |
mouse_x,mouse_y = mouse.pos() | |
mouse_btn = mouse.button() | |
Then use mouse_* variables for position and button clicks. | |
]] |
This file contains 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
pico-8 cartridge // http://www.pico-8.com | |
version 16 | |
__lua__ | |
-- seeding testing | |
-- goal is to use the date as seed value, which will make it so | |
-- the sequence of values coming out of the pool are the same | |
-- every time the cart is reset | |
function rand_table(t) |
This file contains 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
// Add data-repeat attribute to the element you want repeated, the value being the quantity | |
// That element will be cloned and appended X number of times *after* the original. | |
var torepeat=document.querySelectorAll("[data-repeat]"); | |
for (a=0;a<torepeat.length;a+=1) { | |
var el=torepeat[a]; | |
var rpt=el.getAttribute("data-repeat"); | |
for (r=0;r<rpt;r+=1) { |
This file contains 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
body {margin: 1em;} | |
a, a:visited { color: blue; | |
text-decoration: none;} | |
a:hover { | |
border-bottom: 1px solid; | |
} | |
a[href*="//"]:not([href*="codepen.io"]) { |
This file contains 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 get-contrast-color($bgcolor) { | |
$darker-ratio: color-contrast($bgcolor, #000); | |
$lighter-ratio: color-contrast($bgcolor, #fff); | |
@if($darker-ratio > $lighter-ratio){ | |
@return #000; | |
} | |
@if($lighter-ratio > $darker-ratio){ | |
@return #fff; |
This file contains 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
// Color options | |
$grad_names: "green" "fuchsia" "teal" "purple" "orange"; // Name to used as modifier | |
$color_p: $color-green $color-fuchsia $color-teal $color-purple $color-orange; // Dark color | |
$color_s: $color-green-dark $color-fuchsia-dark $color-teal-dark $color-purple-dark $color-orange-dark; // Light color | |
@for $i from 1 through length($grad_names) { | |
$gn: nth($grad_names, $i); | |
$cp: nth($color_p, $i); | |
$cs: nth($color_s, $i); | |
NewerOlder