Shared Code

Please Note: This code exchange has been deprecated. You can still browse, but the code here may be out of date. We strongly recommend you visit and contribute your code to our new code exchange.

Latest Additions


The latest additions of sample code and code libraries shared by developers for Corona SDK.

Client And Game Server For Building Multiplayer Game Using Corona

Hi Community, Here is my first effort to make a multiplayer game with Corona. Server Game can be implements by Cubeia Firebase: (http://www.cubeia.org/index.php/component/content/article/1) http://dl.dropbox.com/u/55451790/firegame.zip http://dl.dropbox.com/u/55451790/GameServerClient.zip To start Server, go to pom.xml file folder and type maven command: mvn firebase:run (No Database and Setup require) Happy Coding... More...

Posted by luonghuutinh, Posted on 4 Jun 2012, Last updated 4 Jun 2012 | 0 comments

Delegate, a way to forget about the stupid closures

A delegate utility to make the use of closures easier and extend them easy with extra parameters. Can be very usefull when used for eventListeners or timer.performWithDelays. Also makes the code written so much more readable code. It's very easy and you never have to use those stupid, unreadable closures anymore. And this code is just a few lines, nothing more than just combining different core LUA functions... More...

Posted by oskar7, Posted on 4 Jun 2012, Last updated 4 Jun 2012 | 3 comments

DMC Lib - Touch Manager

dmc_touchmanager is a module which controls how multi-touch events are processed within an application. Unlike the default multi-touch behavior in the Corona SDK (which could be considered very broken), this will allow you to track any amount of events and un/set focus any one of them to or from an object. Basically bringing you true, proper multi-touch capability to your app. More...

Posted by dmccuskey, Posted on 2 Jun 2012, Last updated 2 Jun 2012 | 9 comments

Simple shape collision routines

A LUA module to enable simple collision checks without physics. Save the following code into a new lua file, and include it in your projects with something like: 1 2 local collisions = require( "collisions" ) local isInside   = collisions.pointInRect( 0, 0, -5, -5, 10, 10 ) - Point in rectangle = pointInRect( pX, pY, rLeft, rTop, rWidth, rHeight ) - Point in circle = pointInCircle( pX... More...

Posted by rakoonic, Posted on 28 May 2012, Last updated 1 Jun 2012 | 4 comments

TimeMachine.lua

a separate component that will take care of adjustingFPS for you (and eventually allowing for slow-mode and etc.). update: 2012.06.02 - Added improvements via Jared at PagodaWest Games (thanks!) GameScreen.lua: (somewhere in your game code) 1 2 local TimeMachine = require("TimeMachine") TimeMachine.start() TimeMachine.lua: 1 2 3 4 5 6 7 8 local M = {}   M.fps = 30  ... More...

Posted by producerism, Posted on 25 May 2012, Last updated 2 Jun 2012 | 0 comments

Randomize / Shuffle and Array - Super Simple Method

Hi This is Adrian Tschubarov from Buenos Aires, Argentina. When you want to shuffle the elements of an array, say for a cards game or a memory game or whatever, you can use this simple solution. This is the function and how to use it 1 2 3 4 5 6 function randomSort(a,b)     local c = math.random(1,10)     return (c < 6) end   table.sort( yourTableHere,... More...

Posted by adrian.tschubarov, Posted on 25 May 2012, Last updated 25 May 2012 | 1 comments

Jumper : Fast 2D Pathfinder for Grid-based games

Jumper is a Pathfinder for 2D grid based games. Thanks to the algorithm used (Jump Point Search), it operates extremely fast, even on huge maps. This library is written in pure Lua. It can be plugged into any project where pathfinding is needed to route units or entities in flat world. Full documentation plus visual demos and benchmarks tests are available on the Github repository. More...

Posted by roland.yonaba, Posted on 25 May 2012, Last updated 25 May 2012 | 69 comments

Simple Loader Bar

Last time i added the simple function to insert the objects safely. Now, let's build the LoaderBar. We're going to make a simple set of the objects within the single container, which comes handy to use it on the stage. And we're not going to add any kind of business logic inside, just the pure component. But if you wish me to add some - feel free to let me know. More...

Posted by deadmorozz, Posted on 23 May 2012, Last updated 23 May 2012 | 2 comments

Image positioning using GIMP

Hi, just a small function which helped me position stuff in my game. In order to use it open up python-fu console (Filters->Python-Fu->Console), paste the code and hit Enter. 1 2 3 4 5 6 def positions():         for layer in gimp.image_list()[0].layers:                 x,y = pdb.gimp_drawable_offsets(layer)  ... More...

Posted by krystian6, Posted on 23 May 2012, Last updated 23 May 2012 | 2 comments

Lua Class System - Object Oriented Library For Your Projects

I am sharing a small work of my own, a clean and light-weight class system I have been working on. Lua Class System (LCS) is a library for (pseudo) object oriented mechanisms. It aims to be something clean, simple to use, minimalistic so that it would easily fit in every project where object-oriented concepts might be needed. Hope some might find it useful. I am still maintaining it so small changes could occur in... More...

Posted by roland.yonaba, Posted on 20 May 2012, Last updated 20 May 2012 | 4 comments

Dynamic Content Scaling Unveiled

As I was getting my head around how Corona SDK triggers what Dynamic Content to use with display.newImageRect() function, based on what is in config.lua , device orientation and the actual physical device resolutions, I developed this small helper app. You can use it to play with your config.lua settings, change the device orientation and test on all simulated and actual devices. It will display what is going on... More...

Posted by CurvedLight, Posted on 17 May 2012, Last updated 17 May 2012 | 0 comments

Particle Library

Particle sugar is particle library. It's api is very similar to particle candy. It implements subset of particle candy's api. you must download source and run it in simulator and read example source, this is best way to understand this library. Particle Sugar support particle type is - shape -- rect -- circle - image(s) - sprite can change several properties like - scale (in/out) - color - velocity - alpha (in/out)... More...

Posted by callin2, Posted on 17 May 2012, Last updated 18 May 2012 | 10 comments

Insert the group object safely

I'm experienced actionscripter, and i've got stucked with the lack of really readable names of the tables in Lua. Well, it's not an issue to reconfigure the mind to avoid that mess. But, one sunny day, i found that i coud not get the the object by it's name inside the group. And that was a challendge. I tried to find the solution digging out the local code samples, but all in vain. Then, i tried to find my own way... More...

Posted by deadmorozz, Posted on 16 May 2012, Last updated 16 May 2012 | 4 comments

Color Transition Wrapper

Since changing color smoothly seems like a task that pops up often during game development, I decided to make a wrapper function (around Corona's default transition.to) in order to make it easier. TO USE : First load the table that contains the function: 1       cTrans = require("colortransition") Then call the wrapper function as such:  cTrans:colorTransition(... More...

Posted by atoko, Posted on 9 May 2012, Last updated 9 May 2012 | 4 comments

Invert, Horizontal Flip and Vertical Flip Physics Shapes

I recently discovered that is was very easy way to invert images, e.g: myObject.xScale = -1, will horizontally flip a display object. This works well but it will not flip any custom physics shapes assigned to the object so in order for the objects to have the correct physics the shapes need to be flipped also. Here is a function I created which will output a new list of flipped or inverted shapes coordinates from... More...

Posted by Beloudest, Posted on 7 May 2012, Last updated 7 May 2012 | 2 comments

Validation of Auto-Renewable In-app purchases

This is a small library which can be used to validate your auto-renewable in-app purchase.. USAGE: If you want to validate without the use of an external server, the usage is as follows 1 2 3 4 5 6 7 8 local validate = require "validate" validate.start { receipt = "Your Receipt Here", password = "Your shared secret key here", listener = listener,         ... More...

Posted by Satheesh, Posted on 5 May 2012, Last updated 17 Sep 2012 | 3 comments

Simple Polygon Triangulation

I've been looking for a way to break a simple polygon into component polygons for a while. I won't tell you why because I'm using it in a game, but I just had to share this solution. It takes any clockwise winding polygon (entered by tapping the screen in sequence) and breaks it into it's interior triangles - literally "triangulation." I can't take credit for the math, which was the only complete and understandable... More...

Posted by horacebury, Posted on 4 May 2012, Last updated 4 May 2012 | 2 comments

URL safe Base64 Encoding in Lua

https://gist.github.com/2563975 A simple Base64 encoder/decoder that uses a URL safe variant of the standard. This implementation encodes character 62 as '-' (instead of '+') and character 63 as '_' (instead of '/'). In addition, padding is not used by default. A full description of the specification can be found here: http://tools.ietf.org/html/rfc4648 To encode, use: 1 base64.encode(input) where input is a... More...

Posted by Varen, Posted on 1 May 2012, Last updated 2 May 2012 | 1 comments

Amazon SimpleDB API Implementation for Corona

This module supports access to the Amazon SimpleDB Service from CORONA. Thanks to shane.lipscomb. This is a polished version of shane.lipscomb's code found in: http://developer.anscamobile.com/forum/2012/02/26/questions-about-amazon-aws-integration#comment-96205 OPERATIONS SUPPORTED : Create Domain Delete Domain List Domains Domain Meta Data Put Attributes Get Attributes Delete Attributes Select USAGE 1 2 3... More...

Posted by Satheesh, Posted on 25 Apr 2012, Last updated 23 Oct 2012 | 14 comments

OWL (Objects with Lua)

OWL is a single-module library that provides an easy way to incorporate object-oriented programming concepts into Corona SDK projects. Supports classes that produce display objects (as well as classes that produce non-display objects), and can even be used with non-Corona Lua scripts as well. Features include: More...

Posted by jonathanbeebe, Posted on 25 Apr 2012, Last updated 25 Apr 2012 | 8 comments

Deploy collision filters easily with Corona SDK

I'm quite new to Lua as well as the Corona SDK, but I faced the collision filters pretty early. They really confused me concerning their behaviours. Finally I found those helpful sheets mentioned in the forums, but I thought it might be even cooler to have a module to handle all the bits within the code itself. So I started writing this helpful tool and thought it might be good enough for a share right here. More...

Posted by markus@sope, Posted on 25 Apr 2012, Last updated 25 Apr 2012 | 3 comments

MovieClipX

MovieClipX MovieClipX (mcx) is a very slick library based off the original MovieClip library for Corona SDK. It adds a few very awesome features including More...

Posted by -Garet-, Posted on 24 Apr 2012, Last updated 24 Apr 2012 | 3 comments

Jump without the physics engine

well i started looking for a way to create a game without using the physics engine and letting the player jump and i used the hit test that was provided from one of the users in the website now the logic is that you need to play with the player y value to be able to control the jump and the falling down have fun with the code i hope you like it in the get hub you need to go to the download to get the file More...

Posted by mtayyar, Posted on 24 Apr 2012, Last updated 24 Apr 2012 | 4 comments

Action sheet for corona.

CActionSheet *** IMPORTANT **** This file uses the widgets library so it must be in your project if you plan to use it I haven't done much lua programming (1.5 days), I used segmented control I found here somewhere and couldn't find an action sheet one, so I looked at how they did it and created a action sheet. Thanks to the original person who posted the segmented control here somewhere... HOW TO INSTALL 1) copy... More...

Posted by SnapApps, Posted on 23 Apr 2012, Last updated 24 Apr 2012 | 4 comments

Shortest Path Through A Concave Polygon With Holes

This program draws the shortest path between two points inside any polygon (with or without holes). The source for this program is C code by Darel Finley found at http://alienryderflex.com/shortest_path/ and translated into Lua by horacebury and me. The program lets you draw a bounding polygon that is either a convex polygon or a concave polygon. Other polygons can be drawn within the bounding polygon to create “... More...

Posted by brucemartin, Posted on 19 Apr 2012, Last updated 20 Apr 2012 | 13 comments

Parse for Corona SDK

This sample project shows how to communicate with Parse.com, a back-end data service, from a Corona SDK app. You should be able to adapt it to your needs with minimal changes. See main.lua for a barebones UI. To use the parse.lua module, add: 1 local Parse = require("parse") to your main project file and refer to functions as shown in main.lua. You'll want to use SDK build 2012.782 or later, for... More...

Posted by Dotnaught, Posted on 15 Apr 2012, Last updated 15 Apr 2012 | 9 comments

deform images by leveraging capabilities of spritesheets

So what do you do if you want to make an animation that involves deforming an image in corona? Carlos said you cant do it... Eat this.... library file now in github heres an example of how to use it 1 2 3 4 5 6 7 -- VERSION -- -- This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. -- -- http://creativecommons.org/licenses/by-sa/3.0/ -- -- Absolutely no warranties or... More...

Posted by open768, Posted on 14 Apr 2012, Last updated 23 May 2012 | 5 comments

UUID v4 Generator

A pure LUA implementation of an RFC4122 UUID v4 generator. Requires no external libraries or hosted services. Also useful as starter code for restricting the namespace of the UUID. As written, it will generate duplicate UUIDs only when generated at the same time (based on 32-bit time). It's quite easy to integrate some crypto function calls to generate some pseudorandom bits with a salt of your choosing to restrict... More...

Posted by toby2, Posted on 10 Apr 2012, Last updated 10 Apr 2012 | 0 comments

Line intersection

Another little demo with sample code to calculate the intersection point between two lines. As always from me, you'll need the mathlib.lua here (because it has the key function): https://developer.anscamobile.com/code/maths-library main.lua: 1 2 3 4 5 6 7 8 9 10 11 12 -- line intersection require("mathlib")   -- http://local.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/   -- turn off... More...

Posted by horacebury, Posted on 8 Apr 2012, Last updated 8 Apr 2012 | 0 comments

gituid - A way to get a Unique ID for a user/app

A simple way to get a unique ID for your app. Feel free to use my hosted version or host your own. 1 2 3 4 5 6 7 8 9 10 11 12 -- -- getuid.lua -- Get a  Unique ID -- -- Graciouslly donated to the Public Domain -- -- Usage: -- local AppID = "com.yoursite.yourapp" -- local guid = require("getuid").getuid(AppID) -- -- Assumptions:  Any use of a UDID is for some use online.  If your... More...

Posted by robmiracle, Posted on 8 Apr 2012, Last updated 8 Apr 2012 | 0 comments

Basic Grid / Table Renderer

Very rudimentary function to render tabular or grid data in exactly that fashion, ie. a table or grid. createGrid function requires two variables: design/layout settings and data to populate the table. Please see comments in grid.lua for implementation. Readme.txt on github will be updated if need be. Right, that explanation more than aptly explains it I believe. Now, how to get to this 50 word limit. Enough yet? More...

Posted by sq2, Posted on 5 Apr 2012, Last updated 5 Apr 2012 | 1 comments

Polygon fill and Point in Polygon detection

Source of my inspiration: http://alienryderflex.com/tutorials.shtml local widthheight, isclosed, isperpixel = 1, false, false local widthheight, isclosed, isperpixel = 10, true, true NOTE: The functions in this demo are provided in the mathlib.lua found here: More...

Posted by horacebury, Posted on 5 Apr 2012, Last updated 5 Apr 2012 | 2 comments

Simple Lua Table Save & Load

Hi, I'm not sure if anyone is going to use it, but I wanted to share this little piece of code. Currently it is designed to work with Corona XML Parser. What this code does is simply store lua table into an xml file and load it afterwards. More...

Posted by krystian6, Posted on 4 Apr 2012, Last updated 4 Apr 2012 | 0 comments

Quick Bubble Popper

Another common forum request. This will show some spawning, touch handling with table listener and object removal. Also shows some forward declarations for the "cart-before-the-horse" issue. Added some collision bounds and EndGame removal mechanics. Added some Group usage examples and proper reverse-removal of objects. Also note use of .alive to prevent "double-taps". Split into module to show ONE WAY this can be... More...

Posted by TheRealTonyK, Posted on 1 Apr 2012, Last updated 1 Apr 2012 | 13 comments

Cool Linear Velocity Chaser

A forum post that needed some "chaser" type functionality drove me to throw this together. It shows how to use timers and Linear Velocity to make objects smoothly and kind of "organically" chase another object Hope you have fun with it, I know I did! 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 local physics = require("physics")   physics.start()   Random = math.random   local... More...

Posted by TheRealTonyK, Posted on 31 Mar 2012, Last updated 31 Mar 2012 | 2 comments

bitmap font

I needed a bitmap font library that could individually adjust the spacing of letters. TextCandy is cool and has load of features but I didnt need them - so I wrote one from scratch. to use this 1) use texturepacker or bitmapfontgenerator to generate a spritefile and definition lua 1 2 3 4 5 local oSpriteData= require("texturepakerluafile") local aSpriteMap = require("myfontmap")... More...

Posted by open768, Posted on 29 Mar 2012, Last updated 29 Mar 2012 | 1 comments

Preference Library - Save data to Files ( tables/numbers/strings/boolean )

This small useful module can be used to store and retrieve values across different app sessions. You can save TABLES, NUMBERS, STRINGS or BOOLEANS. FUNCTIONS 1 2 3 4 5 preference.save preference.getValue preference.getAllValues preference.print preference.printAll USAGE AND EXAMPLES 1 2 3 4 5 6 7 8 9 10 11 12 13 local preference = require "preference"   --Store numbers preference.save{a=1}... More...

Posted by Satheesh, Posted on 26 Mar 2012, Last updated 5 Apr 2013 | 20 comments

Cat-mull-rom open and closed

So, got back into the old bezier stuff again and figured it might be fun to try and get the curve passing straight through the control points. Makes it more useful for plotting courses for game characters, because players are not going to be drawing lines and placing control points - they'll just drag out a path or whatever and the character should traverse it, etc... More...

Posted by horacebury, Posted on 25 Mar 2012, Last updated 25 Mar 2012 | 1 comments

Rate It Button

I made a simple extension that makes it easier to add a "Rate it" button to a Game or App. 1 2 3 4 5 6 7 8 9 10   local rateit = require("rateit")     rateit.setiTunesURL(1234564)   rateit.setAndroidURL(1234564)     function buttonTouched(event)     rateit.openURL()     end Simple version of using it within what... More...

Posted by Richard P., Posted on 24 Mar 2012, Last updated 25 Mar 2012 | 17 comments

Wellen

Many, many (too many) years ago, I was in love with my Acorn Archimedes and on an Acorn Computer Magazine cover disc was a little BBC BASIC program called Wellen. It was a simple row of red circles, connected by elastic bands - well, green lines. Though simple, it was great fun to see how the mathematics worked with these springy balls and to throw them around the screen. This is the Corona Physics version - using a... More...

Posted by horacebury, Posted on 24 Mar 2012, Last updated 24 Mar 2012 | 3 comments

transition class library

--====================================================================-- -- TRANSITION CLASS --====================================================================-- --[[ - Version: 1.0 - Made by Krishna Raj Salim @ 2012 - linkedin profile : in.linkedin.com/in/krishnarajsalim - facebook profile : www.facebook.com/krishnarajsalim - Mail: krishnarajsalim@gmail.com ****************** - INFORMATION... More...

Posted by krishnarajsalim., Posted on 23 Mar 2012, Last updated 1 Apr 2012 | 1 comments

Script to replace object:removeSelf() with display.remove(object) in all lua files in a folder

We know it's safer to use display.remove(object) instead of object:removeSelf(). Use this perl script to automatically change all instances of xyz:removeSelf() with display.remove(xyz) in every .lua file in a folder. This was written quickly and tested on one project -- Be sure you make a backup before using it -- it will make changes to your source files. 1 2 3 4 ## Replaces all instances of object:removeSelf... More...

Posted by scott0, Posted on 22 Mar 2012, Last updated 22 Mar 2012 | 7 comments

Collisionator - Filter Generator

I've created a tool to generate collision filters quickly for use in apps & games: http://labs.zanuka.com/collisionator3000XL/index.html * UPDATE: New version uploaded April 2, 2012. This version automatically selects the reciprocal object collision so you no longer have to tick both manually. For example if you want object 2 to collide with object 1, just select one collision in the grid and the other will be... More...

Posted by ZANUKA, Posted on 22 Mar 2012, Last updated 1 Apr 2012 | 11 comments

"Cordinate formater" for Zwoptex, adds compatibility for ImageSheets

1. Open Zwoptex->Preferences->cordinate formats 2. Add new 3. Paste 1 2 3 4 5 6 7 8 9 10 11 module(...)   -- This file is for use with CoronaSDK™ and was generated by Zwoptex (http://zwoptexapp.com/) -- -- The function getSpriteSheetData() returns a table suitable for importing using sprite.newSpriteSheetFromData() -- -- Usage example: --               ... More...

Posted by sheraz.jamshed, Posted on 21 Mar 2012, Last updated 21 Mar 2012 | 0 comments

Display Extensions

With so many regular operations being performed by code I thought it was time I wrote a library which helps with all this. Operations provided are: - Making a shorter global reference to the stage object - An 'indexOf' function for finding the index of a display object within a display group As with my other libraries, this will grow with time. You may notice that there are some functions designed to extend the '... More...

Posted by horacebury, Posted on 21 Mar 2012, Last updated 6 Dec 2012 | 1 comments

Simplex noise

Hi. Another utility, this one for simplex noise. Simplex noise generates a random-ish number between -1 and +1, when given a set of 2, 3, or 4 numbers. (I suppose a braver soul might do more...) It has the useful property that "close" inputs, e.g. nearby points or similar velocities, will yield close outputs. More...

Posted by StarCrunch, Posted on 16 Mar 2012, Last updated 16 Mar 2012 | 0 comments

Multiply-with-carry random number generator

Hi. This module lets you create lightweight (just a closure with two upvalues) instances of a random number generator, e.g. for getting per-object (deterministic) random number sequences. Some motivation is given in the middle sections here: Networking Is Hard (Part 2) 1 2 3 4 5 6 --- This module implements a multiply-with-carry RNG. -- -- Based on code and algorithm by George Marsaglia: -- [MWC](http://www.math.uni... More...

Posted by StarCrunch, Posted on 16 Mar 2012, Last updated 16 Mar 2012 | 0 comments

Improved Page Curls

UPDATE: I have recoded this into a module that supports multiple pages. It is currently at or above feature parity except for the animation when you release your finger (this will be updated at some point in the future). You can find it here: http://developer.coronalabs.com/node/29465 Heres an example of how to make an attractive AND interactive realistic page curling effect. It's all the little things that really... More...

Posted by dedoubleyou1, Posted on 15 Mar 2012, Last updated 4 Aug 2012 | 20 comments

(Not-) Verlet Rope

Just playing about with some of Carlos' code and thought to myself, "Doesn't the bezier line look like a rope?"... So I made the control points physics objects, joined them with distance joints and fixed the first one in place. While the following code has major performance issues, I'm sure, it could probably serve as the basis for some interesting effects. I have commented in CAPITALS everywhere I've changed the... More...

Posted by horacebury, Posted on 15 Mar 2012, Last updated 15 Mar 2012 | 2 comments

Storyboard Goto (no initial delay)

This fix eliminating the initial delay explained in this thread: http://developer.anscamobile.com/forum/2011/12/03/initial-delay-storyboardgotoscene In your main.lua override the gotoScene function 1 2 3 4 5 -- require controller module  local storyboard = require "storyboard   -- override goto function storyboard.gotoScene = require "goto" Add file goto.lua 1 2 3 4 5 6 7 8 9 10 -- Project:... More...

Posted by Johantd04, Posted on 13 Mar 2012, Last updated 13 Mar 2012 | 6 comments

Sprite Sheet Packer for Corona ImageSheets

Sprite Sheet Packer (Windows Only) is a FREE and fully featured tool by Nick Gravelyn for combining multiple individual images into a single, efficiently laid out image. Get it here: http://spritesheetpacker.codeplex.com/ This SpriteSheetPacker.lua module by Michael Wilson (me!) takes the Output Text files SSP creates and creates a table that works seamlessly with Corona's new ImageSheets... 1 2 3 4 5 6 module... More...

Posted by no2games, Posted on 13 Mar 2012, Last updated 13 Mar 2012 | 1 comments

Tar Extraction Module

Hey guys, I am aware that loads of you have been looking for a way to extract archives with Corona for a long time now. I am planning on implementing more archive support for corona in C/objective c but more info on that later. So for now, here is a solution done in pure lua. From benchmarking it took 1.3 seconds to extract a 10mb tar archive. I created the test tar archive using a mac app named "betterZip" however... More...

Posted by Danny, Posted on 13 Mar 2012, Last updated 13 Mar 2012 | 1 comments

Simple Progress Bar

This is a simple and easy to integrate progress bar which includes "heartbeat" animation to reflect activity even when not updating. More...

Posted by bob.dickinson, Posted on 12 Mar 2012, Last updated 12 Mar 2012 | 1 comments

Transition Manager 1.0

Transition Manager 1.0 Syntax: instance.Start(object, time, xValues, yValues) Example: 1 2 3 local transman = require "transman" local square = display.newRect(50, 50, 0, 0) transman.Start(square, 500, {50, 100, 150, 200, 250}, {50, 100, 150, 200, 250}) Parameters: - object: A display object that will be the target of the transition. - time: A number that specifies the... More...

Posted by joelwe, Posted on 11 Mar 2012, Last updated 14 Mar 2012 | 1 comments

easy event handling in your classes (tables)

Having been fed up of passing callbacks into functions I thought that there had to be a better way. Wouldnt it be useful for any object to be able to register listeners and dispatch events? now you can. :-) 1 2 3 4 5 6 require "lib-events"   myClass={} cLibEvents:instrument(myclass) -- consumers of myclass can use addEventListener -- myclass can use dispatchEvent lib-events.lua 1 2... More...

Posted by open768, Posted on 11 Mar 2012, Last updated 21 Mar 2012 | 0 comments

DMC Lib - Trajectory

dmc_trajectory is a module which provides a method to have objects follow ballistic trajectories without using the physics engine. It's as simple as setting up an object transition with a few Corona parameters. Features simple, single trajectory method object can be auto-rotated to match the slope of the trajectory path additional methods to get trajectory calculations Documentation Quick Guide: http://docs.... More...

Posted by dmccuskey, Posted on 11 Mar 2012, Last updated 1 Feb 2013 | 3 comments

Texturemapped Raycasting Engine

As a follow up to my original code share of the Corona port I did of my 2D raycasting engine, texture mapped walls have been added. This was achieved using sprite sheets. The downside of this is the frame rate takes quite a hit compared with the flat filled walls shown in the original sample. I know I can optimise how I use sprites in this demo, but I still think more needs to be done to get the frame rate up -... More...

Posted by Jesder, Posted on 10 Mar 2012, Last updated 10 Mar 2012 | 20 comments

Stopwatch Timing Class

Current Version: 1.2 Stopwatch is an easy way to create and manage timers (not the performWithDelay kind!), clocks, and any other timekeeping your app might require. Count down to from any number to 0, count up to infinity, pause and resume, and more! 0. Require stopwatch Simply add stopwatch.lua to your project folder, and require it into the files you need it like so: 1 local stopwatch = require "stopwatch... More...

Posted by Kyle Coburn, Posted on 9 Mar 2012, Last updated 9 Apr 2012 | 28 comments

Conway's Game of Life for Corona SDK

A quick code share to create Life within Corona. This is great learning example to master 2D arrays and to soak up some game logic roots! The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. Check out the full story on my blog at Conway's Game of Life for Corona SDK More...

Posted by croisened, Posted on 9 Mar 2012, Last updated 9 Mar 2012 | 0 comments

Basic ladder control for sprite

I have been trying to figure out how to do this and finally put all the pieces together (sort of). I saw a several questions about this in the forum, and never really found a solid answer, so I thought I would share the code I worked up. The basic answer is "When player collides with ladder, turn gravity off". But your 'up' button needs to track what state the gravity is in or the player movement can get wonky.... More...

Posted by sds65805, Posted on 9 Mar 2012, Last updated 9 Mar 2012 | 0 comments

Detect display size

First put this in your config.lua: 1 2 3 4 5 6 7 application = {         content = {                 width = 320,                 height = 480,                 scale = "letterbox"         }, } now put this in the top of your main... More...

Posted by g6dev.mk, Posted on 8 Mar 2012, Last updated 8 Mar 2012 | 0 comments

Streaming "News Ticker" (Twitter Feed or Online Text File)

I wrote the following bit of code for an app I'm working on where I wanted to have a "news ticker" scroll along the bottom of the home screen that I could change remotely. I also briefly considered streaming the most recent tweets from a Twitter account - so I'm including that code as well. See the commented-out text below for notes on how to change the ticker text or Twitter feed that displays. If you copy this... More...

Posted by jasonschroeder, Posted on 6 Mar 2012, Last updated 6 Mar 2012 | 24 comments

Pauseable Transitions, unified timer and transition module, can replace built-in

Here is yet-another pausable transition library. I call it "ctrans", short for "custom transitions". It is different in that it keeps track of all transitions internally, rather than just tag on data to tween objects. This keeps the size of the tween objects small and allows you to perform actions on a large set of transitions with a simple command. More...

Posted by kenneth34, Posted on 4 Mar 2012, Last updated 10 Apr 2012 | 11 comments

A useful CROP LIBRARY

So this is a small Crop Library I put together. Hope you guys find it useful :) Feel free to play around with the code. Do comment below if you have any modifications. Here's a screenshot USAGE 1 2 crop = require "cropper_library_from_satheesh" crop(img,options) OPTIONS 1 2 3 local options =                         --  POSSIBLE... More...

Posted by Satheesh, Posted on 3 Mar 2012, Last updated 26 Mar 2012 | 12 comments

3D Object Rendering

A new example I wanted to share with you guys, was some 3D Object rendering. Not quite as exciting at the raycasting sample I posted a few weeks back, but still interesting enough I think ;) Glenz: Wireframe: More...

Posted by Jesder, Posted on 2 Mar 2012, Last updated 2 Mar 2012 | 7 comments

Facebook helper/support module

This library creates a wrapper around the Corona SDK Facebook API support. Using this library will streamline your Facebook client logic and make it easier to debug and to catch/handle errors (well, it did for my anyway, YMMV). The biggest feature is probably that it supports Facebook functionality in the simulator (for most things). More...

Posted by bob.dickinson, Posted on 2 Mar 2012, Last updated 2 Mar 2012 | 23 comments

sequencing transitions

Hi I was trying to sequence the transition components of a complex grouping of objects. It was getting a real pain to have to coordinate callback functions. So I wrote a helper class to painlessly sequence the transitions. only one callback - the one called when its all finished enjoy! 1 2 3 4 -- VERSION -- -- This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. -- -- http://... More...

Posted by open768, Posted on 29 Feb 2012, Last updated 29 Feb 2012 | 3 comments

Simple draggable fan demo 2

Due to the Mobile Me / iCloud motions going on, the original Simple draggable fan demo is no longer available. There were considerable bugs with it, so I thought I'd write it from scratch with more reliable code. The main.lua is below, but please go here to get the mathlib.lua, which it requires: mathlib.lua: http://developer.anscamobile.com/code/maths-library main.lua: 1 2 3 4 5 6 7 8 9 10 11 -- simple draggable... More...

Posted by horacebury, Posted on 29 Feb 2012, Last updated 21 Dec 2012 | 2 comments

Audio Pan and Pitch

Adds pan and pitch capabilities to the built-in audio class. . 1 2 3 4 5 6 7 8 9 10 11 12 13 ---------------------------------------------------------- -- Abstract:    SuperAudio - Extends the built-in audio --                              class to provide pan and pitch capabilities... More...

Posted by mrgoose, Posted on 28 Feb 2012, Last updated 29 Feb 2012 | 4 comments

Scrollable Lists (Scrollview alike)

I've recently created a module for lists for one of our apps and I think it is worth sharing. It basically creates lists, both vertical and horizontal using strings (for text lists) or display objects (possibly groups). It is highly customizable. Lists behave like iOS lists where one can scroll farther than the end, and upon release the lists gets back to the last element. Also has momentum for fast scrolling of... More...

Posted by RicardoGraca, Posted on 28 Feb 2012, Last updated 28 Feb 2012 | 22 comments

MapViews on Android using Google Maps API & Javascript

Hi Everybody, I don't know about you, but I've grown desperate waiting for Android MapViews, so I've taken matters into my own hands and come up with what I think is a pretty decent workaround, using HTML, JavaScript, and a WebPopup. Obviously, this isn't a perfect replacement for native mapViews, but it can help get us through in the meantime, and it might come in handy later for devices like the Kindle Fire -... More...

Posted by jasonschroeder, Posted on 27 Feb 2012, Last updated 1 Mar 2012 | 11 comments

Asteroids

I got hit with the urge to write the Atari classic Asteroids using the physics engine and a "no button" touch controls. So, here's the source code. It's really messy, not object oriented but it shouldn't throw too many errors and I've tried to handle the object removal etc reasonably well. There are some principles which n00bs could learn from and some which you should avoid, but all in all if you were to take the... More...

Posted by horacebury, Posted on 27 Feb 2012, Last updated 28 Feb 2012 | 12 comments

Code Genie

This is some code I put together to create a lot of sequential lines of code very fast. Basically code to make more code but faster. The output is printed to the terminal for you to copy and paste so you need to open the main.lua with Corona Terminal open. Although you probably wont be using this source code in your project, hopefully it will speed up the process of making your apps. The finished product would look... More...

Posted by chandler767, Posted on 27 Feb 2012, Last updated 27 Feb 2012 | 1 comments

Ultra Simple Parallax Scrolling

So this is a parallax scrolling module that will handle up to 5 "layers" of parallax. This is made for landscape orientation, but you should be able to just flip a few things in the file and make it work for vertical as well. You can insert as many images as you want within each layer (minimum of 3, I don't think it'll work properly with only 2). Also, all images within each layer will need to be the exact same size... More...

Posted by naveen_pcs, Posted on 26 Feb 2012, Last updated 26 Feb 2012 | 2 comments

Storyboard setScene event

This is a really small library to add an event to the list of events fired by the storyboard api. I found that I wanted to have createScene fired on every gotoScene call simply to prepare the scene so it looked right prior transitioning onto the screen. Of course, this doesn't happen, so I created setScene in it's place. setScene will only fire when createScene is not fired, meaning it can safely be called from... More...

Posted by horacebury, Posted on 24 Feb 2012, Last updated 4 Mar 2012 | 4 comments

Super simple Lua Table Save and Load from file functions

This is about as simple as it gets for reading and writing your game data files in Corona SDK/Lua. It uses the JSON library to do the magical data parsing so you don't have to worry about it. Start with a table. End up with the identical table. USAGE: myTable = {} myTable.musicOn = false myTable.soundOn = true saveTable(myTable, "myTable.json") Then to read it back in: myTable = loadTable("myTable.json") This... More...

Posted by robmiracle, Posted on 23 Feb 2012, Last updated 23 Feb 2012 | 38 comments

Super Simple IAP in 1 Line

I use this in pretty much all my projects, and it works perfectly. I stripped out some of my own custom code, and left it with all the essentials that you need. Please let me know if it works for you. When you try to fetch the price of an item, it seems to be a hit or miss for me. I've tried multiple devices, and I'm not sure why it only works sometimes. Apples IAP servers are pretty bad, and there's lots of small... More...

Posted by naveen_pcs, Posted on 23 Feb 2012, Last updated 23 Feb 2012 | 30 comments

Amazon S3 REST API implementation for Corona

This module supports access to the Amazon Simple Storage Service (S3), a popular cloud-based storage platform, from Corona SDK applications. It supports both synchronous and cancellable asynchronous requests to S3. For more information, see: http://aws.amazon.com/s3/ http://www.anscamobile.com/corona/ More...

Posted by bob.dickinson, Posted on 22 Feb 2012, Last updated 24 Feb 2012 | 33 comments

GUID Creation Module

I needed a way to generate unique IDs for something I was working on, and since Corona doesn't have built in support for guids, and since the only other thing out there had dependencies, I wrote my own. I can't say that they adhere entirely to the spec., but they look right, and they're guaranteed to be unique, so it was good enough for me. They looks like this: DA3C1235-EAE1-2524-7798-63D2D8EBC487 846521A4-D962-... More...

Posted by drbigfresh, Posted on 21 Feb 2012, Last updated 21 Feb 2012 | 3 comments

Android screen sizes and names list

In some cases it's useful to know the actual device in which our applications are running. This can be used to fix specific bugs or deal with specific devices in a certain way. This is an attempt to gather a list of device names as they are found on the actual devices. The list also includes screen sizes, commercial names and may be expanded to include other info if required. The main goal is to know the actual... More...

Posted by RicardoGraca, Posted on 21 Feb 2012, Last updated 23 Aug 2012 | 11 comments

Smooth Bezier Path (Curve) Fitting and Point Reduction

This was my attempt at using the Ramer–Douglas–Peucker algorithm for point reduction and Philip J. Schneider Digital Curve Fitting function (which has still not been implemented, but you can Google "fit_cubic.c" to find out more). I'm all about nice smooth simplified paths, but the only thing I've done so far is got the RDP point reducing algorithm complete and the basics of Tulleken's articles listed below. Please... More...

Posted by ETdoFresh, Posted on 16 Feb 2012, Last updated 16 Feb 2012 | 2 comments

Ad Mediator for Corona®

Ad Mediator for Corona is a client-side ad mediation module very much like AdWhirl. It supports admob, inmobi, inneractive, tapit, madvertise, herewead and house ads out of the box and can be extended easily by using a simple plugin framework. More...

Posted by deniz, Posted on 16 Feb 2012, Last updated 30 Aug 2012 | 107 comments

LunarAds | Promote Apps | Monetize Traffic | Measure Performance

Hi Everyone, Our new ad network SDK for Corona developers is ready for the masses! https://lunarads.com/signup/ It's been running solid for over 2 years in-house and we think it's time to let you guys take advantage of it! We are opening this up to Corona developers first (because we love you guys so much!) Below is the simple Corona wrapper that installs in seconds and lets you begin pushing Lunar ads. More...

Posted by MBD, Posted on 15 Feb 2012, Last updated 17 Feb 2012 | 20 comments

Maths Library

NOTE: I have commented out the line at the top, so you now only need to require the mathlib in your main.lua NOTE: For a full list of my libraries and samples see here: http://springboardpillow.blogspot.co.uk/2012/04/sample-code.html NOTE: I am using DEPRECATED to show that some functions are no longer relevant or correct. NOTE: Added new dot product, cross product and polygon area functions. More...

Posted by horacebury, Posted on 15 Feb 2012, Last updated 22 Jun 2013 | 31 comments

Fractal Art

This is a sample that will render some fractal art using lua and the Corona API. A few years back, I took an interest in fractals and was curious about how to make them. This sample is a port of a C++ sample I wrote back then, showing how to create Mandelbrot and Julia sets. Here you can toggle between them by pressing the toggle button in the lower right corner. There is a small delay on start up as it calculates... More...

Posted by Jesder, Posted on 14 Feb 2012, Last updated 14 Feb 2012 | 1 comments

Raycasting Engine

Back in 1997, I wrote a raycasting engine in Turbo Pascal. It had a number of features and was heading towards being turned into a fully fledged game engine. That never happened. But since then, as I move between development platforms, I like to port a cutdown version of it to help make me familiar with the syntax and API on the new platform. Here is a basic raycasting engine written in LUA with the Corona SDK. More...

Posted by Jesder, Posted on 14 Feb 2012, Last updated 14 Feb 2012 | 16 comments

Page Curl

One of the Tutorials that Jonathan Beebe wrote showed how to implement a page curl effect for your apps. Unfortunately there are some problems with that short example and a number of people have requested fixes. I've modified Jonathan's code heavily and modularized it so people can implement page curl with just a couple of lines of code. I've also fixed the issue that some people were experiencing. Here is an... More...

Posted by KenRogoway, Posted on 14 Feb 2012, Last updated 14 Feb 2012 | 16 comments

Device Metrics for scaling based on screen size

In trying to scale my application to various sized devices from an iPhone to an iPad and everything in between (particularly the Kindle Fire and Nook Color), I have been frustrated by the lack of Corona support for physical screen size. If you want an application to truly scale (and not just be a sized-up phone app when you run on a tablet), then you have to be aware of the physical size of the screen. More...

Posted by bob.dickinson, Posted on 8 Feb 2012, Last updated 8 Feb 2012 | 21 comments

Grid Manipulation Sample Code

This code allows you to move your player by touching the screen. The grid will then manipulate according to the players position. You can change the radius of the manipulated area, and change the line width. We are having problems with lag if there are multiply objects on the grid. If anyone can help solve the issue, we will update our code accordingly. Hope this helps! More...

Posted by Ninja Pig Studios, Posted on 6 Feb 2012, Last updated 3 Mar 2012 | 8 comments

Continuous Scrolling Background

This is some code that was given to me for a continuous scrolling background that works pretty good. Just change the image filenames and set the speed in the code and it ready to go. Go to my website and tweet to get the download link for free. http://j-strahan.com/main/?category_name=free Enjoy this free code and others on my site. Thanks. More...

Posted by jstrahan, Posted on 5 Feb 2012, Last updated 5 Feb 2012 | 6 comments

Particle Candy Effects Creator

This is a simple helper project to ease the creation of Particle Candy effects. I've been looking for a decent GUI to help me invent particle candy effects and couldn't find anything working, so I decided to go ahead and create my own GUI. For now it allows to adjust only Particle Type properties [and without fancy FX or fields or anything like that], but if you would like to get more, please let me know. More...

Posted by krystian6, Posted on 5 Feb 2012, Last updated 22 May 2012 | 44 comments

Accurate tempo/BPM-based timing in your animations and music apps

Accurate tempo/BPM-based timing in your animations and general beat-sequenced stuff. I am using this logic in a spiffy metronome that I am porting over to iOS using Corona. I've used this rock-solid tempo pulse logic in my music apps for various platforms since 1998 and it has never done me wrong. More...

Posted by Gary Duke, Posted on 2 Feb 2012, Last updated 2 Feb 2012 | 6 comments

Much Improved 'dump' function and XML simplify

UPDATE: This post now has a lot more functionality, described just before the code... UPDATE: Slightly improved the list parsing in 'simplify'. Original blog post: http://blog.anscamobile.com/2011/07/how-to-use-xml-files-in-corona/ Original shared code: https://developer.anscamobile.com/code/xml-table-parser This code is an update/huge improvement to my original post, above. The dump function traverses a table's... More...

Posted by horacebury, Posted on 2 Feb 2012, Last updated 30 May 2012 | 14 comments

UTF-8 Encode and Decode

If you have problem using unicode from different network request (like the Facebook graph) you might find the UTF8 Encode function useful. If you need to decode there is a function for that to. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 --- -- Converts all UTF-8 character sets to unicode/ASCII characters -- to generate ISO-8859-1 email bodies etc. --@param utf8 UTF-8 encoded string --@return a ASCII/ISO-8859-1 8-bit conform... More...

Posted by Johantd04, Posted on 1 Feb 2012, Last updated 1 Feb 2012 | 1 comments

Easy Finger Drawing with Undo Functionality

For an app I am soon to release, I needed to allow the user to draw a series of squiggily lines with his or her finger, and to be able to reference or remove specific lines/strokes. The closest bit of code I could find online was actually provided by Carlos (https://developer.anscamobile.com/forum/2011/05/02/need-some-help), but I found that his solution of appending new points onto a single line got laggy the... More...

Posted by jasonschroeder, Posted on 30 Jan 2012, Last updated 30 Jan 2012 | 23 comments

TerraDestructa

Welcome to TerraDestructa TerraDestructa is a grid based destroyable terrain system for corona. This is the first release and should be considered an alpha. I do not think it's ready for a production app quite yet. That's your warning. However it's quite fun to play with and the included main.lua demos the main feature Just touch the squares to carve them away, the physics objects generate on the fly as you draw.... More...

Posted by brad.herman, Posted on 28 Jan 2012, Last updated 29 Jan 2012 | 2 comments

cipr.ui

User interface utilities for Corona, part of the Cipr project. Installation Installation is done with cipr 1 cipr install git://github.com/six8/cipr.ui.git Usage Some examples. See Getting started with Cipr for more examples. See source for full functionality. EffectChain More...

Posted by cixate, Posted on 28 Jan 2012, Last updated 28 Jan 2012 | 0 comments

cipr.struct

Data structure utilities for Corona, part of the Cipr project. Includes: cipr.struct.grid.Grid - An efficient 2D grid cipr.struct.grid.GridView - Translates a Grid into display coordinates cipr.struct.Set - An unorderd set cipr.struct.Vector2D - 2D vector operations Installation Installation is done with cipr cipr install git://github.com/six8/cipr.struct.git Usage Some examples. See source for full functionality... More...

Posted by cixate, Posted on 28 Jan 2012, Last updated 28 Jan 2012 | 0 comments

Cipr

Cipr (pronounced "sipper") is part package manager, part development framework for Corona SDK. Much like Python's pip, Cipr makes it easier to share packages and integrate them into Corona apps. The Goal for Cipr is that there's a generous amount of third-party, best-of-breed packages available for use in Corona apps. This will help new developers get started developing apps sooner and reduce the re-inventing of the... More...

Posted by cixate, Posted on 28 Jan 2012, Last updated 28 Jan 2012 | 1 comments

Radio Like Buttons

I was originally making this for an odesk project, but now that I realized how long it will take to perfect it, I will just update it as I go for everyone to use. It is like a check box. Here is how to use it so far: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 local control = require("control")    newBox = control.newControl(      ... More...

Posted by Gigabook, Posted on 27 Jan 2012, Last updated 27 Jan 2012 | 0 comments