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
-- 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 | |
-- |
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
----------------------------------------------------------------------------------------- | |
-- | |
-- modal.lua | |
-- | |
-- Modal dialog for Corona SDK | |
-- V. Sergeyev | |
-- | |
-- Usage: | |
-- showDialog("You completed the level. \n1st place.", "Next level", "level2", beforeNext) | |
-- |
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() | |
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
-- 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
-- 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
-- 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") |
OlderNewer