Skip to content

Instantly share code, notes, and snippets.

@dermotbalson
dermotbalson / gist:9181463
Created February 24, 2014 03:24
color text
function setup()
t={"This is some ","fancily colored ","text message thingy,","which is a ","mixture ","of ","several totally different ","colors, for your delectation",}
c={color(0),color(255,0,0),color(0,0,255),color(0),color(255,255,0),color(255),
color(255, 0, 0, 255),color(0)}
p=WriteText(t,c,300,300,18)
end
function draw()
background(150)
sprite(p,500,500)
@dermotbalson
dermotbalson / gist:9246685
Created February 27, 2014 08:58
lighting cube
-- 3D basic
-- Use this function to perform your initial setup
function setup()
local dirtBlock = Block()
local grassBlock = Block()
grassBlock.cube.texture = "Planet Cute:Grass Block"
--# Main
--Main
--This program contains over 20 mini-projects created by dave1707 to answer questions asked in the forum
--** How to run the projects **
--When you run the program, you can select any of these projects by number using the slider at upper left
--(Underneath the slider you will see a textbox with descriptions of what each numbered project does)
@dermotbalson
dermotbalson / gist:9560594
Created March 15, 2014 01:38
Lighting tutorials
--# Main
--Main
--This code manages which Code tab is run
--it remembers your last choice, and if you select a different one, it runs that instead
--This has nothing to do with 3D lighting and you can ignore it completely
@dermotbalson
dermotbalson / gist:9561135
Created March 15, 2014 02:41
SbS Physics
--# Notes
--This project shows to use some basic physics, from bouncing balls and spinning
--rectangles, to the basics of a very simple platform game
--HOW TO USE THIS PROJECT
--There are a number of tabs at the top. Press on a tab to see its code.
--# Notes
--This is a simulation of an old puzzle game
--where you have a flat plastic surface with balls that roll around on it
--there are little holes you have to get the balls into by tipping the puzzle to roll the balls
--but there are obstacles, and if you tip too far, the balls come out again
--in this version, we'll start to build the puzzle, and when we add more than one ball, we'll
--start using physics to manage the ball collisions
@dermotbalson
dermotbalson / AddOn Code
Last active August 29, 2015 13:59
Suspects
var self = require("sdk/self");
var widgets = require("sdk/widget");
var tabs = require("sdk/tabs");
//this section provides clickable icon at bottom right of screen
var widget = widgets.Widget({
id: "mozilla-link",
label: "Mozilla website",
contentURL: require("sdk/self").data.url("icon-16.png"),
onClick: GetUsers
function setup()
Settings()
CreateBoard()
Initialise()
end
function Settings()
cellWidth,cellHeight,cellGap,textSize=100,133,10,48
boardValues={ [0]={0,0,0},
function setup()
Settings()
CreateBoard()
Initialise()
state=states.PLAY --NEW
end
function Settings()
states={PLAY=1,END=2} --NEW
function setup()
Settings()
CreateBoard()
Initialise()
state=states.PLAY
end
function Settings()
states={PLAY=1,END=2}
dragXY=nil