Code Exchange: Share Your Code with other Corona Developers

Share Your Code

Latest Additions


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

0 votes
Predictive Aiming / Tower Defense

Here is a physics and a non-physics sample for predictive aiming, auto-targetting or the classic "tower defense" solution. The first sample requires you to tap to add towers. Regular Box2D sensor collision detection is used in the second sample to begin firing at a target. Please note that targets which cannot be hit will not be fired at - this is much more common and more misleading than common sense would indicate... More...

Posted by horacebury, Posted on 22 May 2013, Last updated 22 May 2013 | 1 comments

0 votes
VIVE

VIVE Versatile Independent Variable Encoder (rhymes with "hive") An easy, reliable, and flexible way to convert tables to strings and vice-versa. Supports keys of type "string" or "number" Supports values of type "string", "number", "boolean", or "table". What is VIVE? More...

Posted by Caleb P, Posted on 21 May 2013, Last updated 21 May 2013 | 0 comments

1 vote
Ball of light on a sphere

Hi. This is something I was playing around with (in part because I was without an Internet connection for a while...). It's a self-contained version of the linked Github snippet (which is probably subject to change... I think some other ideas might better fit the "pixels" idea). Basically, there's a ball of light roving around a sphere. There's some lighting calculations going on, according to where the ball is, and... More...

Posted by StarCrunch, Posted on 17 May 2013, Last updated 17 May 2013 | 0 comments

2 votes
Remote Events

"Remote Events" is a small package we developed for debugging accelerometer events. It includes two main modules: 1. Client app you can compile for iOS or Android and run from your device 2. Server module which you "require" in your project main lua which is ran on the Corona Simulator. You will need to add the file "remoteEvents.lua" to your project root path. Once you add the module to your project add the... More...

Posted by gtt, Posted on 5 May 2013, Last updated 5 May 2013 | 1 comments

1 vote
Mario Style "Star" Effect

This will make an effect where your screen will flash through random colours like when you have a Star in Mario. The effect will cover the entire screen and it's self contained in a single lua file. All cleanup will automatically be done after the animation is finished (or if you end it early by calling stop() - see below for more details) Require the module:  local rainbowScreen = require("... More...

Posted by naveen_pcs, Posted on 20 Apr 2013, Last updated 20 Apr 2013 | 1 comments

0 votes
Easy setFillColor Transition

Here're 2 small self-contained functions you can use to perform a smooth transition for fillcolors: Usage: Initially set a fill color via: (We need this so that we can know what the color to transition FROM is) 1 2 local g = display.newRect(0, 0, 100, 100) setFillColor(78, 186, 248) Then just call the set fill color transition via: 1 2 -- sets the color of 'g' to {255, 128, 0} for 3000 milliseconds... More...

Posted by bfintal, Posted on 16 Apr 2013, Last updated 16 Apr 2013 | 1 comments

0 votes
Convert RGB to HSB/HSV

If you want to convert HSB to RGB, look at my snippet here https://developer.coronalabs.com/code/convert-hsbhsv-rgb Now, I needed to convert a RGB value back to HSB, so here it is: 1 2 3 4 5 6 7 8 9 10 11 function  rgb2hsb (rR, gG, bB)         local r, g, b = rR/255.0, gG/255.0, bB/255.0         local h,s,v = 0,0,0         local hsbColorTable... More...

Posted by canupa.com, Posted on 14 Apr 2013, Last updated 14 Apr 2013 | 0 comments

3 votes
Calendar Sample

Hi! This is a simple calendar sample to implement in your storyboard app. I couldn't find any calendars when I searched the forum so I made this myself. It's pretty straight forward, everything is in the calendar.lua. Features: - Displays current month and all of its days. - Change months To-do-list: - Add an event to a day - SQL-integration - Theme selection (change of colors) - Slide to change months I'm still... More...

Posted by joelwe, Posted on 12 Apr 2013, Last updated 13 Apr 2013 | 1 comments

0 votes
AES using http://crypto-js.googlecode.com

Uses JS from http://crypto-js.googlecode.com to build a AES value... Change "Secret Text" to what you want to encrypt. --[[]] local function webListener( event ) URLA = event.url if event.url then print( "You are visiting: " .. event.url ) if string.find ( URLA, "url:" ) ~= nil then native.showAlert( "AES:", string.sub(event.url,5,string.len(event.url)) , { "OK" } ) print ( string.sub(event... More...

Posted by Minion Multimiedia, Posted on 5 Apr 2013, Last updated 5 Apr 2013 | 0 comments

0 votes
Daily bonus

A five-day cycle for daily bonus You'll be needing this preference library: http://developer.coronalabs.com/code/save-data-files-tablesnumbersstringsboolean 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 prefs = require "preference_library"           local function checkForSinglePlayerBonus( )                   local lastDayNum = prefs.... More...

Posted by paskuniak, Posted on 2 Apr 2013, Last updated 2 Apr 2013 | 1 comments

0 votes
Structuring your display objects and their transitions/timers for easy removal

When building a display object, structure the timers and transitions under it. So, when it comes time to destroy the object, any timers and transitions you've used regarding it will be properly canceled, preventing any memory leaks or crashes due to unresolved tweens. With the two functions below, you can destroy a single object, an object in an array, or an entire array of objects. 1 2 3 4 5 6 7 8 local function... More...

Posted by BeyondtheTech, Posted on 1 Apr 2013, Last updated 1 Apr 2013 | 1 comments

0 votes
Sweeping through a table of display objects

Perhaps some of you know this already, but it wouldn't hurt to post, since it can help bring everyone up to speed. Let's say you create a table of display objects, like gems, or missiles or enemy ships, and you want to sweep through the entire table to do something with them, like making them all explode or disappear instantly. More...

Posted by BeyondtheTech, Posted on 25 Mar 2013, Last updated 25 Mar 2013 | 1 comments

1 vote
CBResources

After much work, CBResources has just been finished. Includes a manual, reference, bragging rights, sample browser app, roadmap, info, and the old, outdated previous samples. To run the sample app, you'll need to copy CBEffects into the CBResources root folder. Edit Apr. 6: Supports Widget 2.0 Enjoy! Caleb More...

Posted by Caleb P, Posted on 20 Mar 2013, Last updated 6 Apr 2013 | 1 comments

1 vote
Doug Lapsley

Maybe something that others have already done, but a small amend to spriteGrabber to enable sub folders to reference the png if the sprites are in a sub folder. --SpriteGrabber Version 1.2 December 12, 2010 At line 195 replace: local iSpriteSheet = sprite.newSpriteSheetFromData( sheetName..sheetExtension, sData ) with local iSpriteSheet = sprite.newSpriteSheetFromData( string.gsub(sheetName,... More...

Posted by doug.lapsley, Posted on 18 Mar 2013, Last updated 18 Mar 2013 | 0 comments

1 vote
Basic LinkedIn Integration

This is adapted from the Corona Twitter sample code project. So far this will simply allow a user to log in and post a "share" to their stream (LinkedIn shares are essentially the same as Facebook status updates, or Tweets). You will first need to setup a LinkedIn app (http://developer.linkedin.com) and then enter the API Key and Secret Key from there to the top of the LinkedIn.lua file. The "doPostUpdate" function... More...

Posted by AlanPlantPot, Posted on 17 Mar 2013, Last updated 17 Mar 2013 | 0 comments

2 votes
GridView for Corona SDK

This UI is used to show a GridView on the screen, which is sort of a photo album. It could show the figure as buttons, and labels on each figures. In addition, the label length is adjusted when the string length is longer than the figure width. You can control the GridView position, and how many columns are shown in each row. Go ahead to apply this library in your project. Only few line, you can show the GridView... More...

Posted by shihhsin, Posted on 17 Mar 2013, Last updated 17 Mar 2013 | 1 comments

0 votes
Switch physics display mode on device

If you want to switch between normal and hybrid physics mode on your device using a shake is a good way to do this without needing to use an on-screen button, which would need to be taken out later... 1 2 3 4 5 6 7 8 9 10 11 12 13 14 -- switches physics mode easily on device local hybridon = true function jerk(e)         if (e.isShake) then          ... More...

Posted by horacebury, Posted on 13 Mar 2013, Last updated 13 Mar 2013 | 0 comments

0 votes
Simple particle gravity with path plotting

This is a slightly modified version of the "Simple particle gravity" code which only uses one particle but plots the course the particle will take. Tap to add gravity points. Swipe to add lots of particles. Video: http://screencast.com/t/tJ0g5SdwA main: 1 2 3 -- simple particle gravity - path prediction   --http://board.flashkit.com/board/showthread.php?629375-HELP-2D-gravity-simulator-multiple-mass-points More...

Posted by horacebury, Posted on 12 Mar 2013, Last updated 12 Mar 2013 | 0 comments

0 votes
Simple particle gravity

This is a particle gravity demo that I converted from a flash forum post. It's pretty straightforward and open to a lot of fiddling. Requires no supporting library. Swipe to create particles, tap to create gravity wells. Video: http://screencast.com/t/NKnifkMcYb main.lua: 1 2 3 -- simple particle gravity   --http://board.flashkit.com/board/showthread.php?629375-HELP-2D-gravity-simulator-multiple-mass-points More...

Posted by horacebury, Posted on 11 Mar 2013, Last updated 11 Mar 2013 | 0 comments

0 votes
loadSoundLibrary: a quick way of structuring and loading your sound effects

If your code (and your build files) are getting a little discombobulated with all the sound effect files you have to load, this little code snippet can make loading sounds a lot easier with a lot less code. As your development progresses, many of you might notice a growing list of sound files sitting in the same folder as your image files as well as your lua code, so having a long directory could get a little messy... More...

Posted by BeyondtheTech, Posted on 8 Mar 2013, Last updated 8 Mar 2013 | 0 comments

0 votes
Stackbuster: a Jawbreaker clone

I was asked to create a game like Jawbreaker from Windows, Windows Mobile and other devices. Here it is in its full glory. Does not need or use any assets, as everything is drawn using Corona's own graphics APIs. 1 2 3 4 5 6 7 8 9 10 ----------------------------------------------------------------------------------------- -- -- stackbuster.lua -- created by Raphael Salgado as BeyondtheTech -- version 1.0 -... More...

Posted by BeyondtheTech, Posted on 7 Mar 2013, Last updated 7 Mar 2013 | 1 comments

0 votes
Batch convert AIFF/MP3/WAV files to CAF

If you're working with another party that tends to hand you audio files in another format, but you need it in CAF format for use with iOS devices (IMA 4:1 compression provides the smallest files possible, which is great for constrained memory limits on mobile devices), use this bash script in Mac OS X. Simply copy it to the same folder as the compatible audio files (must be .AIFF, .MP3, and/or .WAV), and run it in... More...

Posted by BeyondtheTech, Posted on 7 Mar 2013, Last updated 7 Mar 2013 | 0 comments

0 votes
Calculate Area of a Polygon

This is a straight forward conversion of the code found here: http://www.mathopenref.com/coordpolygonarea2.html Be aware that it will not calculate the area of polygons which which intersecting vertices - that is, if the polygon is twisted so that its lines cross over, it will not work properly. main.lua: 1 2 3 4 -- polygon area   stage = display.getCurrentStage() sWidth, sHeight = display.contentWidth... More...

Posted by horacebury, Posted on 5 Mar 2013, Last updated 5 Mar 2013 | 0 comments

3 votes
Sidebar UI example

This is a quick and nasty demo of a sidebar UI like Facebook. This code was done quickly just to show the basic concept and not to be used in production. The idea is for people to understand the concept and expand on it, creating their own version with better/more finalized code. I have seen comments in the forums on if this was possible so here is just a small demo with some code to show that it is possible.... More...

Posted by chevol, Posted on 2 Mar 2013, Last updated 2 Mar 2013 | 0 comments

3 votes
Twitter fix for HTTPS

Twitter with oAuth recently stopped to work, because twitter no longer accepts non secure requests. I've modified oAuth module to support HTTPS. Basically replaced http.request with network.request. Thus added async networking. Also I've cleaned those examples to look better. So now it's more visual and you can add new api calls in it easily. I've added two new methods - getFollowers() - gets a list of your... More...

Posted by Lerg, Posted on 2 Mar 2013, Last updated 2 Mar 2013 | 1 comments

0 votes
newtext align right ( it works ! )

This is a modified version of the newretinatext function from the beebegames-class ( http://developer.coronalabs.com/code/beebegames-class ). This function aligns every font in every size without gaps, leaps... to the right ( what we would like to have from setreferencepoint( display.CenterRightReferencePoint). The original class wasn't working properly for me. but it brought me on the right track. see for yourself... More...

Posted by romanfischer, Posted on 28 Feb 2013, Last updated 28 Feb 2013 | 1 comments

1 vote
Polygon Intersection

This code detects where two polygons intersect and produces a third polygon for the intersection area. I have not tried it with particularly complex polygons, but it should be enough for use with Box2D body shapes. Please note that I got this from rosettacode.org and have simply modified it enough to work with Corona and provide a demonstration. main.lua: 1 2 3 4 5 6 7 -- http://rosettacode.org/wiki/Sutherland-... More...

Posted by horacebury, Posted on 26 Feb 2013, Last updated 26 Feb 2013 | 1 comments

1 vote
Simple Bubble Popper

Bubble Popper for the CoronaSDK This template was constructed to demonstrate many aspects of programming in lua for Corona. It is an updated version of some simple code I posted quite some time ago which helped many users get a start. This new version goes much further with graphics and the intent to show many different techniques that are not quickly identified when starting with Corona. You will learn How to... More...

Posted by TheRealTonyK, Posted on 24 Feb 2013, Last updated 13 Mar 2013 | 11 comments

0 votes
Barcode Scanning w/Pic2Shop

Shows how to integrate Pic2Shop barcode scanning. (iOS for the time being) build.settings 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 -- cpmgen build.settings settings = {         orientation =         {                 default ="portrait",              ... More...

Posted by Minion Multimiedia, Posted on 19 Feb 2013, Last updated 19 Feb 2013 | 2 comments

0 votes
Btl - Easy to Use Debugging System - Version 1.1

Overview: Update 1.1 - Added Globals Checker Btl (pronounced "beetle") is a very easy to use debugging system. It can keep track of time, check memory, log entries, or find globals. It's very lightweight and has three draw modes - terminal, visual, or programmatic. In terminal draw mode, all values are printed to the terminal. In visual draw mode, a simple GUI is created with the stats on it - please note that the... More...

Posted by Caleb P, Posted on 16 Feb 2013, Last updated 18 Feb 2013 | 1 comments

1 vote
Transition Manager

The Transtion Manager was developed for transitions could be paused and resumed Usage example: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 local TransitionManager = require 'TranstionManager' local isPaused = false   local transitionManager = TransitionManager.new()   local circle = display.newCircle(100,100, 40) local rect = display.newRect(10,10, 40, 40)   local function... More...

Posted by stephannvasconcelos, Posted on 15 Feb 2013, Last updated 15 Feb 2013 | 3 comments

1 vote
User rating by a 5-star view library

Because Corona SDK has not supported the rating view, I create a library named starView to do that job. It is quite simple to apply this library in three lines. First, we include the starView library in the program. 1         local starsView = require("starsView") Then, we initialize the starView object. The parameters are the x, y, initial star numbers, and is editable of the... More...

Posted by shihhsin, Posted on 14 Feb 2013, Last updated 14 Feb 2013 | 2 comments

0 votes
Jumping pony game

Jumping pony game is demo project for lutsk.io meetup. App use physics engine and touch events to move pony left or right. Gravitation move pony bottom and it bounces from the grass. It is a very easy example, targeted for the begginer Corona SDK developers. Total code lines is about 20. Video on Youtube Enjoy! More...

Posted by vova.sergeyev, Posted on 8 Feb 2013, Last updated 8 Feb 2013 | 0 comments

1 vote
Sol Control RTS game

Space real-time strategy. We have spent about a year working on it and it looks like long-time-never-published project. So we pushed it to open source :) At first game was create primarily for iPad device. But as it use Corona SDK framework, so can be compiled to Android, Nook, Kindle devices as well. Sample videos Game is fully functional, Enjoy! More...

Posted by vova.sergeyev, Posted on 8 Feb 2013, Last updated 8 Feb 2013 | 1 comments

0 votes
Convert HSB/HSV to RGB

See http://en.wikipedia.org/wiki/HSV_color_space for more info Original source: http://www.docjar.com/html/api/java/awt/Color.java.html "This function converts the components of a color, as specified by the HSB/HSV model, to an equivalent set of values for the default RGB model." 1 2 3 4 5 6 7 8 9 10 11 12 13 function    hsv2rgb    (h, s, v)         local r,g,b... More...

Posted by canupa.com, Posted on 5 Feb 2013, Last updated 14 Apr 2013 | 1 comments

1 vote
Thumbprint Scanner

This project I created for several reason and I’m pleased to share it with all of you. If anyone has used my Corona Shell Project (A starting point for any project) based on Director 1.4 you know how handy it is to get a jump start on a new project when you already have some plumbing in place. I created this Thumb Scanner as a fun aspect to “secure” scenes from users until they put in the proper code and “scan”... More...

Posted by croisened, Posted on 4 Feb 2013, Last updated 4 Feb 2013 | 0 comments

0 votes
Super Simple and Freakishly Fast Bitmap mask creation for ScrollView using ImageMagick

So you want a scrollView that only takes up some of the screen? You'll need a bitmap mask, which is pretty easy to create using your favourite GUI tool but not that quick and if you don't have or know your way around photoshop or GIMP somewhat daunting. But if you have ImageMagick installed you can do it in one line from the command line: For a scrollView W x H: 1 convert -size W+4xH+4 xc:black -fill white -draw... More...

Posted by james03, Posted on 4 Feb 2013, Last updated 4 Feb 2013 | 0 comments

1 vote
DMC Lib - Auto Store

dmc_autostore is a Lua module which makes saving application and game data painlessly easy, because it uses NO API ! At the start you are given an empty Lua table. You add and remove data as you need. Any modifications which you make anywhere in the data structure will save your changes to JSON. Super simple? Yes ! Super awesome? Definitely !! Features A great fit with object-oriented programming More...

Posted by dmccuskey, Posted on 1 Feb 2013, Last updated 10 Feb 2013 | 2 comments

1 vote
Corona Tiled

Loads JSON saved map files from Tiled http://www.mapeditor.org/ Author: Michael Wilson / NO2 Games, Inc. - www.no2games.com More updates in v0.4 SUPPORTED JSON or LUA exported map files Multiple Layers Multiple Tilesets Custom Tile shapes Finding Objects by name Setting Physics properties from the map editor Object types (regular, polygon, line) that support physics properties Uses Corona Image Maps and Image Map... More...

Posted by no2games, Posted on 31 Jan 2013, Last updated 9 Apr 2013 | 0 comments

1 vote
Force Object Pass-Through

Lets say you have a ball and a wall. You want the ball to pass through the wall, but only if the ball hits the wall with a low enough force (or high enough - whatever threshold.) Problem: Box2D only provides the "event.force" value in the "postCollision" event. This means that you can only measure the amount of force the ball hit the wall with once the ball has bounced off the wall and is travelling away from it.... More...

Posted by horacebury, Posted on 25 Jan 2013, Last updated 25 Jan 2013 | 0 comments

0 votes
NeonPong - Complete Pong Sample Game/Template

I made a complete version of Pong for a demo/sample code example. I commented all of the code (heavily) and it wasn't all that complicated in the first place, so there should be no trouble with understanding it :) There is a CPU, different difficulties, (easy, medium, hard, and endless), and it does collision checking and moving of the ball without physics. It's also quite fun ;) More...

Posted by Caleb P, Posted on 17 Jan 2013, Last updated 30 Jan 2013 | 4 comments

6 votes
Google Connect

Google Connect is a simple module for connecting with google APIs via OAUTH2 The module also persists the user's refresh token so the he only needs to log in and authorise the app once. Example usage: 1 2 3 4 5 6 7 8 9 10 11 local gConnect = require("googleConnect")   function connectCallback(event)         if(not event.isError) then      ... More...

Posted by contato00, Posted on 14 Jan 2013, Last updated 14 Jan 2013 | 4 comments

1 vote
Krooshal: In-App Update Framework

Krooshal for Corona is a super-simple SDK to keep your Corona apps updated. You integrate it during development and when deployed on device, ensures your testers and users are running the latest version. When you release a new version, simply set the update to mandatory/optional on krooshal.com and users will be alerted next time they open up the app. More...

Posted by krooshal, Posted on 14 Jan 2013, Last updated 31 Jan 2013 | 0 comments

1 vote
Useful MULTILINE TEXT Library

WARNING : UGLY CODE AHEAD This library can be used to create multiline texts.. How this differs from the in-built multiline text feature is, EACH LINE OF THE MULTILINE TEXT WILL BE A SEPARATE TEXT OBJECT ITSELF . Although each line is a separate display object,the function returns a single display object group so you can manipulate the single display object group. You can access the individual text objects as well... More...

Posted by Satheesh, Posted on 8 Jan 2013, Last updated 20 Jan 2013 | 2 comments

3 votes
Chains

Demo: http://www.screencast.com/t/LWElsGoCfzyc Since the ragdoll sample was included in the Corona samples directory to demonstrate the setContinuous function, I've wondered about other uses. The code below allows the user to draw a chain and have it fall onto a collection of obstacles. This was previously difficult in Corona because eventually the forces upon the joints would break the chain apart. Use the circle... More...

Posted by horacebury, Posted on 8 Jan 2013, Last updated 8 Jan 2013 | 1 comments

8 votes
Ouya Support

Easily add OUYA controller support for your Corona SDK games. Check out main.lua to see an example. Check out the video of our game Zombie Dash which uses this class: http://youtu.be/zq8mSTrpmqA. Or download the app for iOS on itunes: https://itunes.apple.com/us/app/the-zombie-dash/id584241591 main.lua 1 2 3 4 5 6 7 8 9 10 11 local function ouyaListener( event )           --add your... More...

Posted by RedPistonEB, Posted on 7 Jan 2013, Last updated 7 Jan 2013 | 8 comments

1 vote
Idit

Idit is a visual level builder. I create physical levels by creating rectangles with physics and positioning them on top of my level. However, when doing this, a great deal of trial and error goes into it - "Ok, so I'll put it with 150 X. Oops! What about 175 X? Oops! What about 165 X? Ooops!" - etc. More...

Posted by Caleb P, Posted on 7 Jan 2013, Last updated 30 Jan 2013 | 1 comments

3 votes
Paginated ScrollView widget

I was in need of paginated ScrollView - and the "page" width should be allowed to be lesser then the screen width. So I came up with this very simple modification of the standard widget: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15   local widget = require ( "widget" )   function newScrollView ( params )         local sc = {}         if... More...

Posted by kender, Posted on 3 Jan 2013, Last updated 3 Jan 2013 | 1 comments

1 vote
ladder game

Please help me.Ladder game object, which creates a ladder, do not go ..Unfinished source code I created to raise.Complementary to, please let us know.Completion to give you the help. AskStart has been recently dropped really hard for me .. TT display.setStatusBar( display.HiddenStatusBar ) local bg = display.newImage("black.png") local textObject = display.newText("1 2 3 4 5 6 7 8 9 10",6,10,nul,20) textObject:... More...

Posted by 78webmst, Posted on 1 Jan 2013, Last updated 1 Jan 2013 | 0 comments

1 vote
ladder game

Please help me.Ladder game object, which creates a ladder, do not go ..Unfinished source code I created to raise.Complementary to, please let us know.Completion to give you the help. AskStart has been recently dropped really hard for me .. TT display.setStatusBar( display.HiddenStatusBar ) local bg = display.newImage("black.png") local textObject = display.newText("1 2 3 4 5 6 7 8 9 10",6,10,nul,20) textObject:... More...

Posted by 78webmst, Posted on 1 Jan 2013, Last updated 1 Jan 2013 | 2 comments

2 votes
Physics.newJoint("elastic")

Demo: http://screencast.com/t/D5kptVm6f Needing to implement a joint which behaves like a piece of elastic but not quite having the right joint setup, I decided to override the physics library newJoint function and implement my own new joint type "elastic". More...

Posted by horacebury, Posted on 29 Dec 2012, Last updated 8 Jan 2013 | 9 comments

0 votes
Side Scroller Game

A side scroller game with Storyboard, Physics (collisions, gravity, forces) as well as Parallax Scrolling. Intended for beginners or people some a small to medium amount of coding experience. Comes with a video tutorial (about 2hrs all up) that shows how to build the entire game. The video tutorial begins at: http://www.youtube.com/watch?v=0GtUxdSeWzk&feature=youtu.be Get the full graphics and lua files here:... More...

Posted by Mark Falkland, Posted on 28 Dec 2012, Last updated 28 Dec 2012 | 4 comments

4 votes
Dropbox REST sample code

Hey Folks, This is sample code that will allow you to download text files to your app in Corona or upload text files from your app. Since this code is based on the REST API, it's possible it could be use for other web services besides Dropbox- however, it will only work with other web services that allow the use of PLAINTEXT. This sample code is based on the advice provided here: https://www.dropbox.com/... More...

Posted by michael714, Posted on 26 Dec 2012, Last updated 1 Apr 2013 | 3 comments

0 votes
Collected Print Statement

Sometimes you don't want your print statements coming out all at once and sometimes you don't want the console simulator timestamps on every print line. And sometimes you want all that but without rewriting 'print(...)' everywhere. Here's a little code which allows you to call 'print()' as often as you like, it then collects all the strings (or other values) you've printed and lets you 'dump()' them to the console... More...

Posted by horacebury, Posted on 26 Dec 2012, Last updated 26 Dec 2012 | 0 comments

1 vote
_activate.lua

_activate a new class with some helpful functions. display print statements on device while app is running display memory usage on terminal or device display a layout grid with custom guide lines and the safe viewing area great for making sure everything looks right across all devices video: http://www.youtube.com/watch?v=WvJqKfXYlPc download: http://j-strahan.com/main/?p=262 More...

Posted by jstrahan, Posted on 24 Dec 2012, Last updated 24 Dec 2012 | 22 comments

1 vote
Bouncy Lines Demo

I was playing around with my ParticlePhysics library (from CBEffects) and I came up with this interesting demo. You'll need to get the ParticlePhysics library and copy it into the root folder. It does get out of sync sometimes, but still, it's quite cool-looking :) 1 2 3 4 5 6 7 8 9 10 11 12 13 local physics=require("ParticlePhysics").createPhysics() physics.start()   local... More...

Posted by Caleb P, Posted on 17 Dec 2012, Last updated 17 Dec 2012 | 1 comments

0 votes
Physics Body Collision Location

Demo: http://screencast.com/t/kDMH2FI2ueW Corona's Box2D implementation does not provide the location of a collision. This library does. It requires that you create a shape for your object, which then needs to be expanded slightly for the collision location checking. This code requires a couple of my other libraries, though you can download the whole solution, too... MathLib: https://developer.anscamobile.com/code/... More...

Posted by horacebury, Posted on 14 Dec 2012, Last updated 14 Dec 2012 | 0 comments

2 votes
Resizable thumbnail viewer

Demo: http://screencast.com/t/vh4mAeRnSv This sample uses a mask on two nested display groups to create a thumbnail which can grow and shrink. The only caveat is that the x,y position of the 'view' (thumbnail) is always the top left. The code is shown below but the whole sample, including images and the mask, are in this zip: https://dl.dropbox.com/u/10254959/ResizeView.2012-12-14.001.zip main.lua: 1 2 3 4 5 --... More...

Posted by horacebury, Posted on 14 Dec 2012, Last updated 14 Dec 2012 | 6 comments

0 votes
Shape creation for use with addBody

To add a body to your images you can use physics.addBody and provide a shape property containing a table of x,y values. This can be easily generated with PhysicsEditor (highly recommended) and other tools, but if you want this functionality in your own Corona app, here's a function to let your user draw their 8-point-max shape. This is useful because it provides line side checking to detect when the shape is concave... More...

Posted by horacebury, Posted on 12 Dec 2012, Last updated 12 Dec 2012 | 0 comments

0 votes
crawlspaceLib addition: positioning newWebView in simulator

This simple addition to the crawlspaceLib will allow you to see the size and position of newWebView() in the simulator, saving a lot of time building for device. It's similar to what happens with web popups with crawlspaceLib 1 2 3 4 5 6 7 8 cache.newWebView = native.newWebView local curView = nil native.newWebView = function ( x, y, width, height )         if not simulator then return... More...

Posted by kender, Posted on 11 Dec 2012, Last updated 11 Dec 2012 | 0 comments

0 votes
TapJoy Module

This is a handy little module to help you promote your app. By purchasing a given amount of installs for your app. The CPU is about 90% less than the competition. I've also included some direct calls to the tapjoy , banner, full screen ad, and offer wall. (these are currently not working) {I'm not sure how to handle the url response. from these } How to use, 1, create a new file called tj_mod.lua 2, copy / paste the... More...

Posted by syoes, Posted on 10 Dec 2012, Last updated 27 Dec 2012 | 7 comments

1 vote
exploding an image

so I posted some articles about deforming images some time ago by cutting images into strips and animating the stripes. Well you dont have to stop at stripes, you can cut an image into square sprites and play with these too. library on git hub as shown plus a working example showing me exploding and contracting. anyone graphically minded can easily extend this to do custom animations. this uses some more libraries I... More...

Posted by open768, Posted on 7 Dec 2012, Last updated 7 Dec 2012 | 6 comments

0 votes
Body Modification

Often developers want to change a physics property of a body after it has been created. This leads to the invention of some very creative ways of destroying and creating a copy of the body. The best way is to know which properties you are likely going to change and having a dummy duplicate which you can activate or even modifying individual collisions with the physics contact object. More...

Posted by horacebury, Posted on 2 Dec 2012, Last updated 6 Dec 2012 | 2 comments

0 votes
Game Center achievement collector

We just released Parallax 2 - and users of "older" devices (iPod4 / iPad1) reported frame drops when achievements are unlocked. Seems like the data connection via WLAN causes some performance issues, especially in fast action games... So here's a snippet for collecting achievements while playing and a method to upload them all at once. It's no magic, just use a table to store the achievement IDs and a for-loop to... More...

Posted by canupa.com, Posted on 2 Dec 2012, Last updated 2 Dec 2012 | 0 comments

0 votes
Dynamic text resizer

This is not as clever as it sounds because the secret is simply to re-create the text object each time its size needs to change. However, I have implemented a resizable masked area to be used, typically, to show a background image under the text which also appears to change, but without scaling. To try this out use your background image of choice, get this mask image and run the code below. Touching the screen will... More...

Posted by horacebury, Posted on 30 Nov 2012, Last updated 30 Nov 2012 | 0 comments

8 votes
CBEffects

CBEffects is a completely free particle system I wrote. It is by far the best product I've ever made. It is infinitely customizable, extremely flexible, and you can make just about any particle effect that you can think of. CBResources CBEffects Forum Update: Version Two and Two-Fifths: -Major memory leak fixes - check the CBInfo document -New "Render" and "DeleteAll" library functions More...

Posted by Caleb P, Posted on 30 Nov 2012, Last updated 20 May 2013 | 65 comments

1 vote
GGTar

This is a GGified version of the Tar module for the LuaRocks project provided here - https://github.com/keplerproject/luarocks/blob/master/src/luarocks/tools/tar.lua Require The Code local GGTar = require( "GGTar" ) Create your GGTar object local tar = GGTar:new() Untar an archive in the temp directory into the documents directory and call a function when done. 1 2 3 local onComplete =... More...

Posted by Glitch Games, Posted on 24 Nov 2012, Last updated 24 Nov 2012 | 2 comments

2 votes
Extremely Simple 3D-ish Tower

I was playing around with movement ratios (objects moving more or less of the original speed), and I came up with this interesting-looking 3D-ish tower, using movement ratios. It's very simple to understand, and I only wrote it for fun. Enjoy! 1 2 3 4 5 6 7 8 9 10 11 local obj={}   local prevX, prevY=1, 1   for i=1, 60 do         obj[i]=display.newCircle(0, 0, 3*i... More...

Posted by Caleb P, Posted on 21 Nov 2012, Last updated 21 Nov 2012 | 2 comments

4 votes
Reorder Table View Items

Preview video: http://www.screencast.com/users/HoraceBury/folders/Jing/media/e651122a-ab28-456e-85ac-79552d7d5d01 If you have seen the Clock app on iOS and wanted to reorder the rows of a Table View in Corona you will have been frustrated. It's not easy and the old widgets don't provide that functionality. This code sample provides a replacement main.lua (which describes how to add this functionality) and a new... More...

Posted by horacebury, Posted on 14 Nov 2012, Last updated 17 Nov 2012 | 2 comments

1 vote
Copy/Paste Touch Function

I often need a touch function for handling the "touch" event. I also often find myself either typing it from memory or copying it from somewhere else. This particular form won't suit all needs, but I find that, at the end of the day, this is my most common version of the function. It handles: - setFocus - checking focus - appropriate return of true/false - callbacks - is target agnostic - ignores the difference... More...

Posted by horacebury, Posted on 11 Nov 2012, Last updated 26 Nov 2012 | 0 comments

2 votes
PinchZoom Made Real Easy

My previous attempt at pinch zooming left some desirable functionality out. Essentially, this was the simple listening to pinch-zoom events in a similar manner to regular touch events. With an extra pair of libraries to help, this version solves that problem. The only caveats with this version are: - Display groups must be used - A display group is required to handle the multitouch touch points You can download a... More...

Posted by horacebury, Posted on 10 Nov 2012, Last updated 10 Nov 2012 | 9 comments

0 votes
Global EventLib

For reasons best known to myself I decided that I needed a way to have a listener function called when an image was loaded. This lead me to thinking that every display function should be able to fire an event when it is used. This expanded to include the graphics library and a limited (but useful) selection of functions from the physics library (auto detection of when physics has been loaded is included.) I call... More...

Posted by horacebury, Posted on 8 Nov 2012, Last updated 8 Nov 2012 | 1 comments

0 votes
Rectangle Drawing Demo

Here's a little demo I made to draw rectangles, like a lot of image editing programs can do. Drag and drop to draw one. When you touch, move, and let go, it will print some stats about the event. I've added quite a lot of comments, so it shouldn't be too difficult to understand :) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 --[[ Rectangle drawing demo.   Drag and let go to make a rectangle. --]] display.setStatusBar... More...

Posted by Caleb P, Posted on 8 Nov 2012, Last updated 8 Nov 2012 | 5 comments

1 vote
Gridmap

Gridmap is a moderately simple map loader. It will load tiled maps created with Tiled. It returns a display group with each layer inside it. I wrote this very quickly; if you find a problem, just post on this page. Gridmap is not extremely sophisticated - no extras, just loading maps. But, I hope it will help someone, as it has helped me. I have also only tried it with orthogonal maps - no isometric ones. Loading... More...

Posted by Caleb P, Posted on 7 Nov 2012, Last updated 29 Nov 2012 | 15 comments

1 vote
Corona SDK Tutorial: Rate Me Popup + Xcode Console

Here is a tutorial I have created that counts how many times the app has been run, saves that as a local setting, and allows you to easily assign different functions depending on how many times the app has run. In my example, if the app is run 3 times, we will show a 'Rate Me' popup. You can download the template for this on my GitHub: http://github.com/CraftyDeano/Rate-Me Youtube Walkthrough: http://youtu.be/... More...

Posted by CraftyDeano, Posted on 6 Nov 2012, Last updated 8 Nov 2012 | 5 comments

0 votes
GGCredit

GGCredit makes it easy to include a form of currency in your game. Require The Code local GGCredit = require( "GGCredit" ) Create or load a credit object local credit = GGCredit:new() Earn some credits credit:earn( 100 ) Spend some credits credit:spend( 60 ) Get the current balance local current = credit:currentBalance() Check if the player has enough to spend some... More...

Posted by Glitch Games, Posted on 2 Nov 2012, Last updated 2 Nov 2012 | 0 comments

2 votes
GGRating

GGRating makes it very easy to include a nag-screen or popup in your app to solicit ratings and reviews from your users. Require the code local GGRating = require( "GGRating" ) Create your Rating object passing in your apps id, the market the game is in, the ask frequency, alert paramaters and optional listener 1 2 3 4 5 6 7 8 9 10 local listener = function( event )     print... More...

Posted by Glitch Games, Posted on 1 Nov 2012, Last updated 1 Nov 2012 | 11 comments

0 votes
App Localization Template

This template shows you how to easily allow your app to support multiple languages. Start off by 'requiring' the translations.lua and settings.lua files and loading the settings and setting the language. settings.load will load the settings file, or create one if it doesnt exist. setLanguage will set the language based on the users phones language and save it in the settings file for future use. If it is not a... More...

Posted by CraftyDeano, Posted on 1 Nov 2012, Last updated 1 Nov 2012 | 0 comments

2 votes
iOS Universal App template - Supports iPhone, iPhone 5 & iPad

Since the iPhone 5 was announced, there has been a little bit of confusion of how to deploy apps for both iPhone, iPhone 5 & iPad within Corona SDK. ​Here is a example project I put on GitHub to show how I have tackled this problem. ​It should be easy enough to follow, as there are only 2 files (main.lua & config.lua) and they are well commented and quite short. Youtube Walkthrough: http://www.youtube.com/... More...

Posted by CraftyDeano, Posted on 1 Nov 2012, Last updated 1 Nov 2012 | 12 comments

12 votes
Perspective

Perspective is a library for easily and smoothly integrating a virtual camera into your game. It supports parallax, advanced layer control, and very smooth tracking. Minor Update 1.4.1 - Fixed a bug with custom layer number; if the layer number was over 8 it would throw an error How to Use Perspective: 1. Create a Camera View 1 2 local perspective=require("perspective") local camera=perspective.... More...

Posted by Caleb P, Posted on 31 Oct 2012, Last updated 17 Apr 2013 | 37 comments

0 votes
Broad-Phase Libraries for Fast 2D Collision Detection

Hi all, Collision detection] is a fundamental topic, featured in a wide range of applications, such as computer games, physically-based simulations, etc. Although simple with a few number of entities, it can turn into a bottleneck, especially when dealing with growing numbers of moving objects, and cause some framerate drops. More...

Posted by roland.yonaba, Posted on 30 Oct 2012, Last updated 30 Oct 2012 | 3 comments

1 vote
GGTwitter

GGTwitter makes it very easy to authorise your player with Twitter and post messages. Authorisation data is stored so that the user only has to login the first time. Required oAuth.lua from here - https://github.com/breinhart/Corona-SDK-Tweet-Media/blob/master/utils/oAuth.lua multipartForm.lua from here - https://github.com/breinhart/Corona-SDK-Tweet-Media/blob/master/utils/multipartForm.lua Require the code local... More...

Posted by Glitch Games, Posted on 29 Oct 2012, Last updated 2 Nov 2012 | 34 comments

2 votes
GGFacebook

GGFacebook makes connecting and posting messages or images to Facebook very easy. More functions will be added in the future. You must have a Facebook app set up with SSO enabled, see this tutorial - http://www.coronalabs.com/blog/2012/01/04/implementing-facebook-single-sign-on/ Require the code local GGFacebook = require( "GGFacebook" ) Create your Facebook object passing in your apps id,... More...

Posted by Glitch Games, Posted on 28 Oct 2012, Last updated 28 Oct 2012 | 46 comments

0 votes
GGPromote

GGPromote makes it very easy to retrieve accurate information on yours, or your friends, apps and games in order to display them in your own as a way of cross promotion. GGPromote does not do any of the display as I decided to leave that up to you but it would be very easy. Sample apps and data can be seen here: http://www.glitchgames.co.uk/ggPromote/ Require the code local GGPromote = require( "GGPromote... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 0 comments

0 votes
GGColour

GGColour makes it very simple to used named or hex colours in your game or app. You can also create custom colour palettes that you can swap out whenever you want. Colour values liberated from here - http://www.tayloredmktg.com/rgb/ Require the code local GGColour = require( "GGColour" ) Create your chart local colourChart = GGColour:new() Get a named colour local r, g, b, a = colourChart:... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 1 comments

3 votes
GGScore

GGScore allows you to create easy to use leaderboards for your Corona SDK powered games. Require The Code local GGScore = require( "GGScore" ) Create or load a scoreboard local board = GGScore:new( "all" ) Set some values 1 2 box:set( "message", "hello, world" ) box.anotherValue = 10 Set the default name board:setDefaultName( "Dave" )... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 18 comments

0 votes
GGTweak

GGTweak allows you to store data in JSON format on a remote web server to be used in your Corona SDK apps. Require the code local GGTweak = require( "GGTweak" ) Create your tweak library, passing in a url, callback function and refresh time. local tweak = GGTweak:new( "http://localhost/data.json", onRefresh, 1000 ) Get a value print( tweak:get( "testValue"... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 0 comments

0 votes
GGMusic

GGMusic allows you to play a list of background music tracks in linear or random order in your Corona SDK powered apps. Require The Code local GGMusic = require( "GGMusic" ) Create your music library local music = GGMusic:new() Add some tracks 1 2 3 music:add( "track1.mp3" ) -- An unnamed track. music:add( "track2.mp3", "MainMenuMusic" ) -- A... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 10 comments

1 vote
GGDictionary

GGDictionary allows for multiple 'languages' to be included in your Corona SDK powered apps. Require the code local GGDictionary = require( "GGDictionary" ) Create your dictionary local dictionary = GGDictionary:new() Create and add a language 1 2 3 4 5 local language = {} language.name = "english" language.strings = {} language.strings[ "greeting... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 0 comments

1 vote
GGSound

GGSound allows for easy management of sound effects and global volume in your Corona SDK powered apps. Require the code local GGSound = require( "GGSound" ) Create your sound library local sound = GGSound:new{ 1, 2, 3 } -- Create the library passing in some channel numbers, these should be reserved by you. Add some sounds 1 2 sound:add( "sound1.wav", "sound1"... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 12 comments

7 votes
GGData

GGData is a simple persistent data storage class for the Corona SDK. It is a replacement/upgrade to Ice that was having too many issues relating to SQLite. Require The Code local GGData = require( "GGData" ) Create or load a box local box = GGData:new( "sample" ) Set some values 1 2 box:set( "message", "hello, world" ) box.anotherValue = 10 Get some... More...

Posted by Glitch Games, Posted on 26 Oct 2012, Last updated 26 Oct 2012 | 31 comments

2 votes
Snippets: Samples, "Game", Editor

Hi. This is another "a bunch of framework and example code" post. It includes several little snippets (a few of which I've previously posted here, individually), as I've been trying to consolidate some of my experiments which don't otherwise have much immediate use. In most cases it should be pretty obvious what these are doing, though for a few it's probably best to consult the readme. More...

Posted by StarCrunch, Posted on 20 Oct 2012, Last updated 20 Oct 2012 | 4 comments

1 vote
Visual Logging/Printing of Events

I made a library that, when a log function is called, logs an entry in a list. If you want to view previous entries, simply tap the yellow button in the corner and your entries become visible. Usage: You can use it in a number of ways. The way I use it is this: 1 2 require("visual_log") print=logEvent The main function inside of the library is called logEvent. When you do that, you change the... More...

Posted by Caleb P, Posted on 16 Oct 2012, Last updated 30 Jan 2013 | 1 comments

16 votes
SSKCorona

What is SSKCorona? The Super Starter Kit (SSK) for Corona SDK is a (currently alpha) collection of my own and other folks' code, art, sounds, and other assets packaged in an easy-to-use kit. SSK contains three major components: 1. SSK Library - A collection of code, art, sounds, etc. which can be dropped into any project. 2. SSK Sampler - An application written using SSK to demonstrate SSK, Corona SDK, and Lua... More...

Posted by roaminggamer, Posted on 15 Oct 2012, Last updated 4 Feb 2013 | 13 comments

3 votes
2-Page Open Book

1 2 3 4 5 6 7 8 9 2-Page Open Book Class for Corona   For displaying an open book Bi-directional page turn curl effect Supports any page size <= display size Supports 1 sound effect per page   To view the full effect download Voyager Kids or Voyager Kids Free from the Apple or Nook app stores www.voyagerkids.com 1 2 3 4 5 6 7 8 9 10 -- --      Main Module to demonstrate 2 page open book... More...

Posted by Edissey, Posted on 23 Sep 2012, Last updated 23 Sep 2012 | 0 comments

0 votes
Image resize and crop to a saved file

Hi All, I needed a tool to make thumbnails/profile pics and couldn't find one. I found two great libraries by Satheesh and horacebury and hacked them together to produce what I needed. It's really ugly but it does the job. I have been helped a lot by the code here and in the forums so wanted to post this back in case it helps someone. It lets the user select an image from the camera roll and then pinch/zoom the... More...

Posted by antonyburrows, Posted on 9 Sep 2012, Last updated 24 Sep 2012 | 13 comments

1 vote
Debug Terminal

I just tossed together a utility to help with debugging and working with Corona features that won't run in the simulator and I thought I would share it. It consists of an Adobe Air application that opens a socket at the ip and port provided and a bit of lua code for sending messages. To use it you would call trace() instead of print() after you include the lua snippet either by copy paste or require. Be sure to... More...

Posted by squarefactor, Posted on 7 Sep 2012, Last updated 7 Sep 2012 | 0 comments

2 votes
TapIt Corona SDK

A simple module for Corona to use TapIt ads on your applications. This module supports banner ads, full screen interstitial ads (wall ads) and alert ads. Features: Banner ads Full screen interstitial ads (wall ads) Alert ads Banner Ads Sample: 1 2 local tapit = require("tapit") tapit.requestBannerAds({zoneId=3644}) Alert Ads Sample: 1 2 local tapit = require("tapit... More...

Posted by deniz, Posted on 6 Sep 2012, Last updated 6 Sep 2012 | 1 comments

1 vote
Remote Push System Notification URL

Alright Lets Go. I know a lot of people want to know how to make a Remote Push Notification system to get the Tokes automatic. First of all, check out this tutorial made by the awesome mans of Ansca to Learn a little bit more about the Remote Push, Make a test to know what you doing, http://www.coronalabs.com/blog/2011/12/21/push-notifications-for-ios-in-corona-sdk/ Now in the GitHuB URL We have A Folder named "... More...

Posted by p.peresjr, Posted on 6 Sep 2012, Last updated 6 Sep 2012 | 3 comments

1 vote
30log : a 30-lines library for object orientation in Lua

30log, in extenso 30 Lines Of Goodness is a minified library for object-orientation in Lua. It features class creation, object instantiation, class inheritance and methods overload through inheritance. And yes, it makes only 30 lignes length. No less, no more. Some usage example, to see how simple it is: 1 2 3 4 5 6 class = require '30log' -- Calls the library Window = class { width = 100, height = 100, x = 10... More...

Posted by roland.yonaba, Posted on 3 Sep 2012, Last updated 3 Sep 2012 | 9 comments