Skip to content

Instantly share code, notes, and snippets.

View nadar71's full-sized avatar
🏠
Working from home

Simone Mapelli nadar71

🏠
Working from home
View GitHub Profile
-- collision library
local collisionslib = {}
local categoryNames = {}
local categoryCounter = 1
local function newCategory( name )
categoryNames[ name ] = categoryCounter
categoryCounter = categoryCounter * 2
-- 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
@nadar71
nadar71 / main.lua
Last active August 29, 2015 14:14 — forked from HoraceBury/_mathlib.lua
-- 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")
-- 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())
-- swipe library
--[[ Libraries ]]--
local composer = require("composer")
--[[ Fields ]]--
local mainstage = display.getCurrentStage()
local stage = composer.stage
-- 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
-- swipe library
--[[ Libraries ]]--
local composer = require("composer")
--[[ Fields ]]--
local mainstage = display.getCurrentStage()
local stage = composer.stage
@nadar71
nadar71 / rgb.lua
Last active August 29, 2015 14:14 — forked from HoraceBury/rgb.lua
-- 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
@nadar71
nadar71 / main.lua
Last active August 29, 2015 14:14 — forked from galahad9/main.lua
--Load Physics Library
local physics = require "physics"
--Show physics drawing lines, for help with debugging
physics.setDrawMode( "hybrid" )
--Start Physics
physics.start()
@nadar71
nadar71 / main.lua
Last active August 29, 2015 14:14 — forked from shawngrimes/main.lua
--Load Physics Library
local physics = require "physics"
--Show physics drawing lines, for help with debugging
physics.setDrawMode( "hybrid" )
--Start Physics
physics.start()