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
-- Corona Game SDK example of how to let two bodies circle each other by applying a continuous, attracting force
--
-- The example uses the physics engine, sets gravity to 0, creates two balls separated in the x-direction,
-- with initial speeds in opposite y-direction.
-- Thru an enterFrame event handler, an attracting force is continuously applied to both balls with body:applyForce().
-- The force is normalized over the distance between the two balls.
-- By playing with the initial speed and force factors, you can make the balls spin faster/slower in circles or ellipses
--
-- Save this file as "main.lua" in a project directory and load it in the simulator
--
@nadar71
nadar71 / modal.lua
Last active August 29, 2015 14:14 — forked from vsergeyev/modal.lua
-----------------------------------------------------------------------------------------
--
-- modal.lua
--
-- Modal dialog for Corona SDK
-- V. Sergeyev
--
-- Usage:
-- showDialog("You completed the level. \n1st place.", "Next level", "level2", beforeNext)
--
@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()
@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 / 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
-- 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
-- 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())
@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")