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
-- collision library | |
local collisionslib = {} | |
local categoryNames = {} | |
local categoryCounter = 1 | |
local function newCategory( name ) | |
categoryNames[ name ] = categoryCounter | |
categoryCounter = categoryCounter * 2 |
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
-- table library extensions | |
-- allows the table.copy function to return a shallow copy of a range of the table items | |
-- Example: | |
--local t={1,2,3,4,5,6,7,8,9,10} | |
--dump(table.copy(t,3,8)) | |
--prints out 3,4,5,6,7,8 | |
local table_copy = table.copy | |
table.copy = function( t, ... ) | |
if (type(arg[1]) == "number" and (arg[2] == nil or type(arg[2]) == "number")) then |
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
-- math lib demos | |
-- demonstrations of each function in the mathlib extension library | |
-- Please be aware that the composer is broken for this file in daily builds 2014.2196 and above. | |
display.setStatusBar( display.HiddenStatusBar ) | |
local composer = require( "composer" ) | |
require("mathlib") |
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
-- polygon concave test | |
require("mathlib") | |
stage = display.getCurrentStage() | |
local text = display.newText{ text="- - -", x=display.contentCenterX, y=100, fontSize=24 } | |
lines = display.newGroup() | |
lines:insert(display.newGroup()) |
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
-- swipe library | |
--[[ Libraries ]]-- | |
local composer = require("composer") | |
--[[ Fields ]]-- | |
local mainstage = display.getCurrentStage() | |
local stage = composer.stage |
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
-- arrow test | |
-- http://www.iforce2d.net/b2dtut/sticky-projectiles | |
-- video: http://screencast.com/t/vcPLSJR6xkIq | |
require("mathlib") | |
local sWidth, sHeight = display.actualContentWidth, display.actualContentHeight | |
local centerX, centerY = sWidth/2, sHeight/2 |
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
-- swipe library | |
--[[ Libraries ]]-- | |
local composer = require("composer") | |
--[[ Fields ]]-- | |
local mainstage = display.getCurrentStage() | |
local stage = composer.stage |
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
-- rgb | |
-- Colors referenced from http://www.tayloredmktg.com/rgb/ | |
local RGB = { | |
neoncyan = {16, 174, 239}, -- Neon Cyan | |
neonyellow = {231, 228, 37}, -- Neon Yellow | |
neonpink = {231, 83, 177}, -- Neon Pink | |
neongreen = {4, 228, 37}, -- Neon Green | |
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
--Load Physics Library | |
local physics = require "physics" | |
--Show physics drawing lines, for help with debugging | |
physics.setDrawMode( "hybrid" ) | |
--Start Physics | |
physics.start() | |
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
--Load Physics Library | |
local physics = require "physics" | |
--Show physics drawing lines, for help with debugging | |
physics.setDrawMode( "hybrid" ) | |
--Start Physics | |
physics.start() | |