Skip to content

Instantly share code, notes, and snippets.

@bobcgausa
bobcgausa / assetTest.json
Created September 8, 2014 22:18
Corona JSON Loader/Manager
{
"sheet_bat": {
"class": ",imagesheet,",
"path": "images/bat.png",
"options": {
"width": 32, "height": 48, "numFrames": 12,
"sheetContentWidth": 192, "sheetContentHeight": 96
}
},
"background_mountain": {
@bobcgausa
bobcgausa / Ellipse.lua
Created August 3, 2014 22:58
Lua Arcs and Ellipses
Ellipse = {
--declare constants
format='%d %d %d %d ',
class=',Ellipse,class,'
}
function Ellipse:tostring()
return string.format(self.format,self.x,self.y,self.width,self.height)
end --tostring
function Ellipse:new(centerX, centerY, wide, tall)
assert(wide>=0 and tall>=0)
@bobcgausa
bobcgausa / exploder
Created March 6, 2014 01:20
Lua polygon exploder and triangulator
--bobcook47@hotmail.com
--M.I.T. license
physics=require ("physics")
physics.start()
physics.setGravity(0,0)
local noObject = true
local function create()
local vertices = { 0,-110, 27,-35, 105,-35, 43,16, 65,90, 0,45, -65,90, -43,15, -105,-35, -27,-35 }
local r, g, b = math.random(),math.random(),math.random()
local o = display.newPolygon( 0, 0, vertices )