Share Your Code

Recently Updated

Recently updated sample code and code libraries shared by developers for Corona SDK.

0 votes
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 | 0 comments

3 votes
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 | 2 comments

4 votes
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 17 May 2012 | 30 comments

0 votes
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

0 votes
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 | 0 comments

7 votes
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 and Disclaimer: I am not a mathematician and never will be. The library I've posted here has been developed to help me do things I don't really understand. I have derived all the code here either from first principles or translated it from other code posted to forums and which I can rely on working. It is... More...

Posted by horacebury, Posted on 15 Feb 2012, Last updated 11 May 2012 | 8 comments

3 votes
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 | 0 comments

1 vote
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 | 0 comments

2 votes
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 5 May 2012 | 1 comments

0 votes
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 | 1 comments

1 vote
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 | 0 comments

5 votes
Follow (and avoid) Object

I ported this nice AS2 follow-object script by Philip Radvan see the original post here http://www.freeactionscript.com/2009/04/enemy-behavior-run-away-follow-player/ fin.lua 1 2 3 4 5 6 7 8 9 10 11 12 local fin = {} local radians = 180/math.pi  --> precalculate radians   fin.distanceBetween = function ( pos1, pos2 )          local sqrt = math.sqrt  ... More...

Posted by canupa.com, Posted on 18 Jan 2012, Last updated 29 Apr 2012 | 12 comments

1 vote
Subfolders for Lua, audio, xml and other files. Keep sanity.

Tired of keeping tons of files inside the root app directory? Want to group similar files in separate folders? Losing your mind while searching for a specific file? Then my solution is right for you! Concept is simple: while coding place your files in subfolders. Access them with: someModule = require('some/subfolder/some_module') That already works for the simulator, but fails when building an end... More...

Posted by Lerg, Posted on 17 Jul 2011, Last updated 29 Apr 2012 | 10 comments

3 votes
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 USAGE 1 2 3 4 5 6... More...

Posted by Satheesh, Posted on 25 Apr 2012, Last updated 25 Apr 2012 | 2 comments

3 votes
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 | 2 comments

0 votes
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

1 vote
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 iGARET, Posted on 24 Apr 2012, Last updated 24 Apr 2012 | 0 comments

0 votes
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

1 vote
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 AppIt All, Posted on 23 Apr 2012, Last updated 24 Apr 2012 | 3 comments

2 votes
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 | 8 comments

7 votes
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 | 4 comments

1 vote
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.... download the full code from https://www.sugarsync.com/pf/D6265787_9225421_754672 heres an example of how to use it 1 2 3 4 -- VERSION -- -- This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License. -- -- http://creativecommons.org/licenses/by-sa/... More...

Posted by open768, Posted on 14 Apr 2012, Last updated 14 Apr 2012 | 4 comments

9 votes
Pauseable timers and transitions with speed adjustment

After searching for pausable timers for corona I found only several implementations. Beebe used enterFrame listener to implement his own timers and transitions. Transition manager has memory leaks and lacks some functionality. So I decided to wrap around existing corona timers and transitions into my own implementation. Remember to free the memory used by this module, I advice you you to call... More...

Posted by Lerg, Posted on 18 Jun 2011, Last updated 14 Apr 2012 | 37 comments

0 votes
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

1 vote
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 | 4 comments

0 votes
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 Revaerie, Posted on 9 Mar 2012, Last updated 9 Apr 2012 | 19 comments

0 votes
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

0 votes
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

1 vote
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 raurir, Posted on 5 Apr 2012, Last updated 5 Apr 2012 | 1 comments

0 votes
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

0 votes
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 5 Apr 2012 | 1 comments

1 vote
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

5 votes
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 | 12 comments

7 votes
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

0 votes
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 | 0 comments

4 votes
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 | 1 comments

0 votes
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 | 0 comments

5 votes
Improved Page Curls

Heres an example of how to make an attractive AND interactive realistic page curling effect. It's all the little things that really add up in the end to make the illusion convincing. The full project file can be found in the GitHub link along with all the images you will need. http://img856.imageshack.us/i/screenshot20120329at401.png http://img829.imageshack.us/i/screenshot20120329at400.png http://img545.imageshack.... More...

Posted by dedoubleyou1, Posted on 15 Mar 2012, Last updated 29 Mar 2012 | 12 comments

2 votes
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 preference = require "save_and_load_library_from_satheesh"   preference.save{a=1}... More...

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

2 votes
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 | 7 comments

3 votes
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 | 0 comments

7 votes
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 | 7 comments

0 votes
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 | 0 comments

0 votes
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 | 3 comments

12 votes
Flash's hitTestObject() emulated using contentBounds

You call this function with two images. It returns true if the images are overlapping, and false if they aren't. This is pretty handy for basic collision detection without using physics. 1 2 3 4 5 6 function hitTestObjects(obj1, obj2)         return obj1.contentBounds.xMin < obj2.contentBounds.xMax                 and obj1.contentBounds.xMax... More...

Posted by jhocking, Posted on 20 Jan 2011, Last updated 22 Mar 2012 | 15 comments

0 votes
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

1 vote
"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

0 votes
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

0 votes
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

4 votes
(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

2 votes
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 | 0 comments

2 votes
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 | 5 comments

1 vote
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 wilson9, Posted on 13 Mar 2012, Last updated 13 Mar 2012 | 1 comments

4 votes
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 | 0 comments

11 votes
Ad Mediator for Corona®

Ad Mediator for Corona is a client-side ad mediation module very much like AdWhirl. It supports admob, inmobi, inneractive, herewead and house ads out of the box and can be extended easily by using a simple plugin framework. Ad Mediator is using providers' http api interface to request and fetch ad banners. By using this method, it knows whether there aren't any ads from a provider and able to select next available... More...

Posted by deniz, Posted on 16 Feb 2012, Last updated 13 Mar 2012 | 88 comments

3 votes
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 12 Mar 2012 | 3 comments

1 vote
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 | 0 comments

12 votes
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 | 17 comments

2 votes
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

0 votes
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

0 votes
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

2 votes
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 CluelessIdeas, Posted on 21 Feb 2012, Last updated 7 Mar 2012 | 3 comments

5 votes
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

2 votes
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

2 votes
Dynamic Resolution Retina Text Class

Overview: Autoscaling retina text with a unified API, embossed option, automatic reference pointing and repositioning. ---- Hey guys, I'm sharing this simple text class because I've personally run into a lot of trouble getting text to scale and align perfectly in Corona over many screen sizes. I'd assume most of you are using some custom workarounds already! More...

Posted by Revaerie, Posted on 14 Dec 2011, Last updated 3 Mar 2012 | 16 comments

8 votes
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

5 votes
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 | 4 comments

4 votes
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 | 11 comments

2 votes
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 | 2 comments

0 votes
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 | 0 comments

2 votes
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 -- simple draggable fan demo... More...

Posted by horacebury, Posted on 29 Feb 2012, Last updated 29 Feb 2012 | 0 comments

1 vote
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 | 3 comments

5 votes
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 CluelessIdeas, Posted on 28 Feb 2012, Last updated 28 Feb 2012 | 14 comments

3 votes
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 | 10 comments

1 vote
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

0 votes
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 003naveen, Posted on 26 Feb 2012, Last updated 26 Feb 2012 | 1 comments

4 votes
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 | 24 comments

0 votes
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 003naveen, Posted on 23 Feb 2012, Last updated 23 Feb 2012 | 16 comments

1 vote
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 | 9 comments

1 vote
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 ScottPhillips2, Posted on 21 Feb 2012, Last updated 21 Feb 2012 | 2 comments

0 votes
Much Improved 'dump' function and XML simplify

UPDATE: This post now has a lot more functionality, described just before the code... 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 contained tree and prints all of it's content to the console... More...

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

2 votes
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 | 17 comments

4 votes
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 | 1 comments

2 votes
Ad Manager for Corona

******************************************************************************************************** This module is obsolete. Please use Ad Mediator for Corona instead. It is an ad mediation module very much like Adwhirl. Ad Mediator for Corona: http://developer.anscamobile.com/code/ad-mediator-corona ********************************************************************************************************... More...

Posted by deniz, Posted on 25 Jan 2012, Last updated 16 Feb 2012 | 11 comments

5 votes
Calculating actual boundaries of your application and device screen size

When you develop some Corona application, you most probably use some content scaling option specified in your config.lua file. Content scaling is described perfectly in this blog post: http://blog.anscamobile.com/2010/11/content-scaling-made-easy/ More...

Posted by mmagrilov, Posted on 13 Jan 2012, Last updated 16 Feb 2012 | 7 comments

0 votes
Trajectory plotting

[EDIT: I have updated the code to provide a better user interface and make the calculated trajectory path longer if necessary] [NOTICE: A maintainable post for the up to date mathlib.lua is available here: http://developer.anscamobile.com/code/maths-library I have not removed it from this post as it may change beyond this sample's use.] More...

Posted by horacebury, Posted on 30 Dec 2011, Last updated 15 Feb 2012 | 9 comments

5 votes
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

13 votes
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 | 13 comments

7 votes
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 | 15 comments

8 votes
Text Wrapper Class

As I needed some text features for my actual project, I wrote a class to wrap some text. Unfortunately I saw only now that there is still one form tom.knox7. As there are a bit more features in my class, i post it anyway for someone who need this features maybe. --------------------------------------------------------------- There are two main usages of the module: 1. You can wrap any text to a desired width, the... More...

Posted by sunmils, Posted on 22 Dec 2011, Last updated 14 Feb 2012 | 48 comments

2 votes
Simple XML Parser

Story I've used XML Parser created by Jonathan Beebe ( http://blog.anscamobile.com/2011/07/how-to-use-xml-files-in-corona/ ) to read small and simple XML files. However for one of my projects I do have a large XMLs to parse which are generated automatically for me. As you know, automatically may mean - random. Using a list of nodes and looping through it was out of the question. This is why I've created this little... More...

Posted by krystian6, Posted on 27 Dec 2011, Last updated 13 Feb 2012 | 6 comments

3 votes
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

0 votes
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

4 votes
Parallax Class

par·al·lax The apparent displacement of an observed object due to a change in the position of the observer. Imagine yourself in a car looking to one side. The grass next to the road goes by fast while the trees in the middle of the field look slower. Meanwhile, the far away mountains look like they are barely moving. This is the essence of parallax. More...

Posted by duff333, Posted on 19 Jul 2011, Last updated 5 Feb 2012 | 31 comments

2 votes
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 | 5 comments

0 votes
XML to table parser

Please see the updated version: http://developer.anscamobile.com/code/much-improved-dump-function-and-xml-simplify http://blog.anscamobile.com/2011/07/how-to-use-xml-files-in-corona/ In the blog post above Jon Beebe explains how to use XML in lua via a small library module. The one downside with this was that tables returned, while well structured, are not structured with the XML naming schema of the XML file. I... More...

Posted by horacebury, Posted on 25 Jan 2012, Last updated 2 Feb 2012 | 0 comments

1 vote
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 | 0 comments

1 vote
Get Sprite by Name in a Sprite Sheet

Are you upset with the order of you sprite sheets? I am :) It's easy, for me, to sort sprite by name, example : "ship_1,ship_2", and to get the index of the first frame. Use the Basic layout in Zwoptex, then choose to order by name/Ascending. Here is a short snippet to get a sprite picture index in a sprite sheet. pSheetData is the sprite sheet used by sprite.newSpriteSheetFromData. pName is the picture name,... More...

Posted by dmekersa, Posted on 27 Jan 2012, Last updated 31 Jan 2012 | 1 comments

7 votes
Upload binary from Corona to PHP script

Uploading a binary from your app to a web server is a bit tricky with Corona... but not if you have this code! ;-) Here's all you need in order to get it done... In your app, you'll want this uploadBinary function: 1 2 3 4 5 6 7 8 9 10 11 function uploadBinary ( filename, url, onComplete )           local mime = require "mime"         local path =... More...

Posted by kennw, Posted on 25 Jun 2011, Last updated 30 Jan 2012 | 27 comments

5 votes
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 | 11 comments