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
-- 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
--[[
Perspective v2.0.2
A library for easily and smoothly integrating a virtual camera into your game.
Based on modified version of the Dusk camera system.
v2.0.2 adds a more stable tracking system and re-implements scrollX and scrollY
--]]
--[[
statemachine.lua
Copyright (c) 2013 Erin Lin
erinylin.blogspot.com
Licensed under the MIT license.
Usage:
local sm = require("statemachine")
local process = sm.new(function(self, time)
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)
local bg = display.newImage("images/bg.png")
bg.x = _W/2; bg.y = _H/2;
local car = display.newImage("images/car.png")
car.x = _W/2
car.y = _H - 250
car.name = "car"
-- understood proprierties of bezier curve
--local curve = bezier:curve({xInitial, xControlPoint1, xControlPoint2, xControlPoint3}, {yInitial, yControlPoint1, yControlPoint2, yControlPoint3})
{
"sheet_bat": {
"class": ",imagesheet,",
"path": "images/bat.png",
"options": {
"width": 32, "height": 48, "numFrames": 12,
"sheetContentWidth": 192, "sheetContentHeight": 96
}
},
"background_mountain": {
-- swipe library
--[[ Libraries ]]--
local composer = require("composer")
--[[ Fields ]]--
local mainstage = display.getCurrentStage()
local stage = composer.stage
--
-- a simple Lua/Corona joystick module based on Rob Miracle's code:
-- http://forums.coronalabs.com/topic/32941-virtual-joystick-module-for-games/
-- simplified some of the code, removing some nice-ities, but it still works
local Joystick = {}
function Joystick.new( innerRadius, outerRadius )
local stage = display.getCurrentStage()
currColor = "white"
local function save( )
display.save( allGroup, "group.jpg" )
end
local function loadVars(theSize)
math.randomseed( os.time( ) )
allGroup = display.newGroup()
rectangles = {}
currW = theSize