<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
      <title>All Discussions - Codea</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussions/feed.rss</link>
      <pubDate>Thu, 23 May 13 12:11:30 -0400</pubDate>
         <description>All Discussions - Codea</description>
   <language>en-CA</language>
   <atom:link href="/Codea/Talk/discussions/feed.rss" rel="self" type="application/rss+xml" />
   <item>
      <title>Codea as REPL</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2831/codea-as-repl</link>
      <pubDate>Thu, 23 May 2013 12:10:59 -0400</pubDate>
      <dc:creator>toffer</dc:creator>
      <guid isPermaLink="false">2831@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hi everyone,
Peraphs someone did it, but I've not found related post. The idea is simple, be able to edit a project  from a computer when Codea's viewer is running. In the first time, I've made some tests with http request and code eval from Codea and build a simple request server on the pc. Here is the proof concept : <a href="http://m.youtube.com/watch?feature=youtu.be&amp;v=BBrCWFya9A0&amp;desktop_uri=%2Fwatch%3Fv%3DBBrCWFya9A0%26feature%3Dyoutu.be" target="_blank" rel="nofollow">http://m.youtube.com/watch?feature=youtu.be&amp;amp;v=BBrCWFya9A0&amp;amp;desktop_uri=/watch?v=BBrCWFya9A0&amp;feature=youtu.be</a>
Sorry for the poor quality, we don't see the first steps (create a new project, and link the lib).
For now, it can : synchronise files between the Codea and the pc, send files to the Documents folder from the pc, evaluate and save chunk of code or entire file, return print output to the pc.
I would post other video and share (when ready) it if someone is interested.</p>
]]></description>
   </item>
   <item>
      <title>We need to support initiatives like this (schools adopting Codea)!</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2830/we-need-to-support-initiatives-like-this-schools-adopting-codea</link>
      <pubDate>Thu, 23 May 2013 11:01:17 -0400</pubDate>
      <dc:creator>Ignatz</dc:creator>
      <guid isPermaLink="false">2830@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Twitter:</p>

<p>"@NKrista: Codea by Two Lives Left</p>

<p>All new Yr7 pupils will be getting this on their iPad's when they start in Sept. <a href="https://t.co/pvC0Uuh8bc" target="_blank" rel="nofollow">https://t.co/pvC0Uuh8bc</a>"</p>

<p>I've sent Nick, who is the assistant head teacher at a school on the Isle of Wight, UK, a supportive message.</p>
]]></description>
   </item>
   <item>
      <title>Making fog with shaders?</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2815/making-fog-with-shaders</link>
      <pubDate>Mon, 20 May 2013 20:03:53 -0400</pubDate>
      <dc:creator>UberGoober</dc:creator>
      <guid isPermaLink="false">2815@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Is there a way to make a fog effect with shaders, where the farther away a mesh is, the more fuzzy and less visible it is?</p>
]]></description>
   </item>
   <item>
      <title>AutoGist v2.08 - Backup your projects by changing a version number.</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2744/autogist-v2-08-backup-your-projects-by-changing-a-version-number</link>
      <pubDate>Thu, 09 May 2013 13:42:20 -0400</pubDate>
      <dc:creator>Briarfox</dc:creator>
      <guid isPermaLink="false">2744@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>*Project MUST be named "AutoGist". This is case sensitive.</p>

<p><em>New</em> AutoGist Installer: <a href="https://gist.github.com/briarfox/5562489" target="_blank" rel="nofollow">https://gist.github.com/briarfox/5562489</a></p>

<p>The Installer is one file. Copy it and paste it over main in a newly created project named AutoGist. Then just run it twice! Thanks to <a rel="nofollow" href="/Codea/Talk/profile/acp">@acp</a> for the code.</p>

<p>AutoGist code - <a href="https://gist.github.com/briarfox/5525674" target="_blank" rel="nofollow">https://gist.github.com/briarfox/5525674</a></p>

<p>AutoGist 2.0 is here! First you will need to create a Github account @ <a href="http://www.github.com" target="_blank" rel="nofollow">http://www.github.com</a></p>

<p>-Open AutoGist and supply your username and password. These are not saved and only need to be used once. After you Authenticate it will save your Github token as a global.</p>

<p>-Exit and reload AutoGist</p>

<p>-You can now use AutoGist to pull full projects from a gist id. You Simply create a blank project, open AutoGist Enter the project name and the gist ID from the gist you want to pull.</p>

<p>-AutoGist can now create a single file that will install all tabs from a Gist. This makes it easy for people who do not have a Gist app. Simply Enter the Name of the Project and the gist id from it's gist. A new gist will be created with one file. That files is ran in place of main and will install the project all in separate tabs.</p>

<p>-You can comment out code that you do not want to appear in the Gist. use</p>

<pre><code>--to comment out code do
--/*
code to comment out
--*/
</code></pre>

<p>This is how you include AutoGist into your project to backup.</p>

<pre><code>To backup your projects you simply add this to your main file and include AutoGist in your project:
VERSION = your version number 
-- When this number changes it will update your Gist. 

BUILD = true/false 
--BUILD will create a separate gist for builds when set to true, version is ignored

In setup add:
autoGist = AutoGist("YOUR CODEA PROJECT NAME","DESCRIPTION",VERSION)
 -- VERSION should be the variable used in setting the version at the top.
autoGist.backup()
 -- if you pass true in backup, your Version gist will be public.
</code></pre>

<p>Thats it! Future update will include Version tracking as a tab within Codea.</p>
]]></description>
   </item>
   <item>
      <title>How do you make a side scrolling game in Codea?</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2829/how-do-you-make-a-side-scrolling-game-in-codea</link>
      <pubDate>Wed, 22 May 2013 22:18:39 -0400</pubDate>
      <dc:creator>Elden123</dc:creator>
      <guid isPermaLink="false">2829@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Pleas help</p>
]]></description>
   </item>
   <item>
      <title>Total newbie - Question about maps.</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2827/total-newbie-question-about-maps</link>
      <pubDate>Wed, 22 May 2013 19:38:21 -0400</pubDate>
      <dc:creator>pete6256</dc:creator>
      <guid isPermaLink="false">2827@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Evening everyone,</p>

<p>I've just been exploring this app and it seems really interesting. I'm just exploring it at the moment and just had a quick question concerning maps.</p>

<p>Does anyone have any code lying around that would enable me to run an app that would display a map of my current location and a little point at the center showing my current location? (Basically the same functionality that the standard 'Maps' app offers already with my ipad.)</p>

<p>Not sure if this is possible?</p>

<p>Any help would be greatly appreciated!</p>

<p>Thanks,</p>

<p>Pete</p>
]]></description>
   </item>
   <item>
      <title>Creating a library of useful shaders</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2821/creating-a-library-of-useful-shaders</link>
      <pubDate>Wed, 22 May 2013 00:49:25 -0400</pubDate>
      <dc:creator>Ignatz</dc:creator>
      <guid isPermaLink="false">2821@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Having been helped to solve some difficult problems with shaders, I can see how useful they are. But for most users, including myself, they are too hard to build.</p>

<p>So a library of useful shaders would be - well, very useful.</p>

<p>I'm happy to help compile it - I know of Andrew Stacey's demo shaders, and I have a couple spacemonkey wrote for me, but do any of you have any shaders that do really useful or cool stuff? If you do, could you share, including a working demo that shows how to use it as simply as possible?</p>
]]></description>
   </item>
   <item>
      <title>How can i edit/crop a Photo</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2537/how-can-i-edit-crop-a-photo</link>
      <pubDate>Sun, 31 Mar 2013 13:31:01 -0400</pubDate>
      <dc:creator>phknestel</dc:creator>
      <guid isPermaLink="false">2537@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>So i want to make an app where you can edit or especialy crop a photo which you have just shot with the camera.
I have already the code for the camera but the photo wich i took isn't  saved it is just down the camera screen.
The code is just the simple code from the exemples.</p>

<p>So i want to Save the photo and i want that the screen changes to the photo after shooting it. So i can edit or crop it.
Thanks</p>
]]></description>
   </item>
   <item>
      <title>Big Bigger - A Game Made with Codea</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2781/big-bigger-a-game-made-with-codea</link>
      <pubDate>Wed, 15 May 2013 04:35:53 -0400</pubDate>
      <dc:creator>wave</dc:creator>
      <guid isPermaLink="false">2781@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>It's available now for $0.99. You can download it from the link below.</p>

<p><a href="https://itunes.apple.com/us/app/big-bigger/id640028352?ls=1&amp;mt=8" target="_blank" rel="nofollow">https://itunes.apple.com/us/app/big-bigger/id640028352?ls=1&amp;mt=8</a></p>

<p>Thanks to people who helped me learn to code in Codea. And all beta testers who helped improve this game a lot.</p>

<p>Thank you Simeon and TwoLivesLeft for Codea too :)</p>

<p>I use Codea Splash Screen in this game, hope it helps people know about Codea more.</p>

<p>Here are some promo codes</p>

<p>Y9WP47H3T4YK</p>

<p>FHJWAT9RHPLL</p>

<p>W4NLE3XJ93L6</p>

<p>3RTPY746XNEK</p>

<p>RYJRR9RLL6XE</p>
]]></description>
   </item>
   <item>
      <title>Question about fonts and rects</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2828/question-about-fonts-and-rects</link>
      <pubDate>Wed, 22 May 2013 21:22:53 -0400</pubDate>
      <dc:creator>Kronusdark</dc:creator>
      <guid isPermaLink="false">2828@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I am trying to make a simple roguelike for my first codea project. I draw my map, then I draw a box over where the player is (to obscure the map tile), then I draw the player. I am doing text for graphics in true roguelike fashion, but It seems if I draw text and a rect at the same coordinates the text sits lower than the rect. Is this normal? I have textMode and rectMode set to center. Tiles are 15x15 and font size is 15. Is the text center normally just a little lower than it should be?</p>
]]></description>
   </item>
   <item>
      <title>polygons draw and fill requested?</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2820/polygons-draw-and-fill-requested</link>
      <pubDate>Tue, 21 May 2013 16:15:11 -0400</pubDate>
      <dc:creator>jasl</dc:creator>
      <guid isPermaLink="false">2820@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hey - Help? For example I really want to draw and fill a hexagon and I have no idea how to do this in Codea. I found some code on the forum that animates through a sequence of polygons which is very cool but not easy for me to decipher, hack and use, plus the polygons are outlines only and not filled. I also read that this was something that may be included in a future version of Codea - Is there still a plan to incorporate this as a feature or have I just asked a really dumb question? Any info greatly appreciated</p>
]]></description>
   </item>
   <item>
      <title>Splinerider</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2826/splinerider</link>
      <pubDate>Wed, 22 May 2013 08:23:26 -0400</pubDate>
      <dc:creator>Luatee</dc:creator>
      <guid isPermaLink="false">2826@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>My take on the flash game line rider using a ball and splines, check it out!
<a href="http://youtu.be/14uCT3_zQAc" target="_blank" rel="nofollow">http://youtu.be/14uCT3_zQAc</a>
Tell me what you think</p>
]]></description>
   </item>
   <item>
      <title>Traffic-Light Simulation</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2825/traffic-light-simulation</link>
      <pubDate>Wed, 22 May 2013 07:11:24 -0400</pubDate>
      <dc:creator>matox</dc:creator>
      <guid isPermaLink="false">2825@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>--Traffic-Light matox 2013/1</p>

<p>A traffic simulation. The three images can be downloaded from the following addresses. Then save in the Documents folder.</p>

<p><a href="http://imageshack.us/a/img805/6471/ampel.png" target="_blank" rel="nofollow">http://imageshack.us/a/img805/6471/ampel.png</a>
<a href="http://imageshack.us/a/img826/3563/streetg.png" target="_blank" rel="nofollow">http://imageshack.us/a/img826/3563/streetg.png</a>
<a href="http://imageshack.us/a/img22/3160/59823085.png" target="_blank" rel="nofollow">http://imageshack.us/a/img22/3160/59823085.png</a></p>

<pre><code>-- Use this function to perform your initial setup
function setup()
    displayMode(FULLSCREEN)
    gox = 100
    speed = 10
    red=color(255,0,0)
    yellow=color(255,255,0)
    green=color(0,255,0)
end

-- This function gets called once every frame
function draw()  
    gox = gox + speed
    if gox &gt; 1200 then gox = -31 end 
    if gox &gt; 400 and gox &lt; 480 and s == true then speed = 0
    else speed = 10; end

      -- Do your drawing here
    --sprite("Documents:Street",WIDTH/2,HEIGHT/2,WIDTH*2,HEIGHT) --foriPad1
    sprite("Documents:Street",WIDTH/2,HEIGHT/2,WIDTH,HEIGHT)  --for iPad4 Retina
    sprite("Documents:VW",gox,100,295,150)
    sprite("Planet Cute:Tree Tall",1000,0,200,800)
    sprite("Documents:Ampel",495,200,116,375)

 if (os.date("%S")) &gt; ("00") and (os.date("%S")) &lt; ("11") then fill(red) ellipse(500,340,40,40);
     noFill() ellipse(500,300,40,40);noFill() ellipse(500,260,40,40); s=true end

 if (os.date("%S")) &gt; ("10") and (os.date("%S")) &lt; ("12")then fill(red) ellipse(500,340,40,40);
     fill(yellow) ellipse(500,300,40,40);noFill() ellipse(500,260,40,40);  s=true end

if (os.date("%S")) &gt; ("11") and (os.date("%S")) &lt; ("26")then noFill() ellipse(500,340,40,40);
     noFill() ellipse(500,300,40,40); fill(green) ellipse(500,260,40,40) ; s=false end   

 if (os.date("%S")) &gt; ("25") and (os.date("%S")) &lt; ("27") then noFill() ellipse(500,340,40,40);
     fill(yellow) ellipse(500,300,40,40); noFill() ellipse(500,260,40,40); s=false end

if (os.date("%S")) &gt; ("26") and (os.date("%S")) &lt; ("41") then fill(red) ellipse(500,340,40,40);
     noFill() ellipse(500,300,40,40); noFill() ellipse(500,260,40,40) ; s=true end  

if (os.date("%S")) &gt; ("40") and (os.date("%S")) &lt; ("42") then fill(red) ellipse(500,340,40,40);
     fill(yellow) ellipse(500,300,40,40); noFill() ellipse(500,260,40,40) s=true end 

if (os.date("%S")) &gt; ("41") and (os.date("%S")) &lt; ("58") then noFill() ellipse(500,340,40,40);
     noFill() ellipse(500,300,40,40);fill(green) ellipse(500,260,40,40)  ; s=false end  

if (os.date("%S")) &gt; ("57") and (os.date("%S")) &lt; ("61") then noFill() ellipse(500,340,40,40);
     fill(yellow) ellipse(500,300,40,40);noFill() ellipse(500,260,40,40)  s=false end

    if (os.date("%S")) &lt; ("01") then fill(red) ellipse(500,340,40,40);
     noFill() ellipse(500,300,40,40); noFill() ellipse(500,260,40,40)   s=true end

end
</code></pre>
]]></description>
   </item>
   <item>
      <title>Doubt on meshes</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2814/doubt-on-meshes</link>
      <pubDate>Mon, 20 May 2013 08:39:32 -0400</pubDate>
      <dc:creator>Saurabh</dc:creator>
      <guid isPermaLink="false">2814@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>If we draw a mesh at one place and then draw it again somewhere else then why doesn't the first mesh disappear and come at the second place. Here's the code it'll give you some idea of what I am trying to say. And why does the alpha of the wall keep changing its less in the begging and then for some angles it becomes 255 any reason for that??</p>

<pre><code><br />--# Main
function setup()
    CreateImage()
    w,h = i.width/2,i.height/2
    m = mesh()
    m.texture = i
    m.vertices = {vec3(-w,-h,0),vec3(-w,h,0),vec3(w,h,0),vec3(w,-h,0),vec3(-w,-h,0),vec3(w,h,0)}
    m.texCoords = {vec2(0,0),vec2(0,1),vec2(1,1),vec2(1,0),vec2(0,0),vec2(1,1)}
    mf = mesh()
    i = readImage("SpaceCute:Background")
    w,h = i.width,i.height
    mf.texture = i
    mf.vertices = {vec3(-w,-h,0),vec3(-w,h,0),vec3(w,h,0),vec3(w,-h,0),vec3(-w,-h,0),vec3(w,h,0)}
    mf.texCoords = {vec2(0,0),vec2(0,1),vec2(1,1),vec2(1,0),vec2(0,0),vec2(1,1)}
    X = 0
    Z = 0
    angle = 0
end

function draw()
    background(255)
    perspective(45,WIDTH/HEIGHT)
    fill(255)
    angle = angle+1
    X = 400*math.cos(math.rad(angle))
    Z = -1100 - 400*math.sin(math.rad(angle))
    camera(X,0,Z,0,0,-1000,0,1,0)
    pushMatrix()
    translate(0,0,-1000)
    m:draw()
    popMatrix()
    pushMatrix()
    translate(100,0,-1100)
    rotate(90,0,1,0)
    m:draw()
    popMatrix()
    pushMatrix()
    translate(-100,0,-1100)
    rotate(90,0,1,0)
    m:draw()
    popMatrix()
    pushMatrix()
    translate(0,0,-1200)
    m:draw()
    popMatrix()
    pushMatrix()
    translate(0,-50,-1100)
    rotate(90,1,0,0)
    mf:draw()
    popMatrix()
end

function CreateImage()
    i = image(200,100)
    local w,h = i.width,i.height
    setContext(i)
    rectMode(CORNER)
    fill(255, 194, 0, 71)
    rect(0,0,w,h)
    fill(255, 0, 0, 255)
    ellipse(w/2,h/2,h/2)
    setContext()
end


</code></pre>
]]></description>
   </item>
   <item>
      <title>How to make a side scroll like mega man</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2823/how-to-make-a-side-scroll-like-mega-man</link>
      <pubDate>Wed, 22 May 2013 04:00:58 -0400</pubDate>
      <dc:creator>Jlew</dc:creator>
      <guid isPermaLink="false">2823@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>How to make a map off the screen... So if you go in or out of a door it's a new background map.... In full screen....</p>
]]></description>
   </item>
   <item>
      <title>HttpRequest download speed and % done</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2822/httprequest-download-speed-and-done</link>
      <pubDate>Wed, 22 May 2013 01:46:36 -0400</pubDate>
      <dc:creator>presidenten</dc:creator>
      <guid isPermaLink="false">2822@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hi there!</p>

<p>Is there any way I can see at what speed Im downloading an png file and how much of it is downloaded?</p>
]]></description>
   </item>
   <item>
      <title>setContext() Limit [RESOLVED]</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2819/setcontext-limit-resolved</link>
      <pubDate>Tue, 21 May 2013 08:31:16 -0400</pubDate>
      <dc:creator>HyroVitalyProtago</dc:creator>
      <guid isPermaLink="false">2819@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hello everybody !</p>

<p>I want to know what's limit of setContext() function. Because after some call, generated sprites are empty =/</p>
]]></description>
   </item>
   <item>
      <title>Secondary layer for sprite and image files.</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2811/secondary-layer-for-sprite-and-image-files</link>
      <pubDate>Sun, 19 May 2013 23:07:52 -0400</pubDate>
      <dc:creator>michaelmaguin</dc:creator>
      <guid isPermaLink="false">2811@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>When drawing up sprites within a 2d xy world sprites work great but when you are entering not 3d programming and using sprites as menu and control items they sit along the 0 point of he z axis. Yes you can draw these items as a mesh and always rotate and align with the camera view but I would be nice if the xy coords were separated from the 3d plain and rendering area of the software. Thus meaning an xy coord for sprite always draws its coord in reference to the xy position of the screen regardless of camera movement</p>
]]></description>
   </item>
   <item>
      <title>cmodule 0.1.1: sneak peek at a dynamic module loading system designed for Codea</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2794/cmodule-0-1-1%3A-sneak-peek-at-a-dynamic-module-loading-system-designed-for-codea</link>
      <pubDate>Thu, 16 May 2013 15:15:37 -0400</pubDate>
      <dc:creator>toadkick</dc:creator>
      <guid isPermaLink="false">2794@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hello,</p>

<p>If you've been around here the last couple of months you might have heard me mention a few times that I have been working on a module loading system designed for Codea. I've been using it now for quite a while in it's current state, and I feel that while it's not yet ready for prime time, it is stable (and hopefully useful) enough to share a "pre-release" version of it. I will consider it at 1.0 when a) Codea supports optional tab execution (which is in the feature tracker), and b) when I figure out how to make it work with exported projects (currently it can only be used within the Codea app itself).</p>

<p>cmodule itself can be found here: <a href="https://gist.github.com/apendley/5411561" target="_blank" rel="nofollow">https://gist.github.com/apendley/5411561</a></p>

<p>and a small test suite with basic examples of usage can be found here: <a href="https://gist.github.com/apendley/5594141" target="_blank" rel="nofollow">https://gist.github.com/apendley/5594141</a></p>

<p>Why use cmodule? Codea's basic module structure is great for prototypes and projects of smaller scope. However, as projects grow larger in scope and become "real" projects, it can be quite cumbersome to manage the global namespace, dependencies, as well as ensuring that your program does not fill up the iPad's memory with code/data that is used only infrequently (e.g. game data, like levels, spritesheet metadata, etc). These problems can all be amplified as well when collaborating with others.</p>

<p>cmodule attempts to fully address this. With cmodule, you can load a tab (file) from any other Codea project on demand, without having to include that project as a Codea dependency (and thus, without cluttering the global namespace). By default, the source code in a module file is not loaded/executed until it is explicitly loaded with cimport/cload, so only modules that are actually used get loaded into memory (and, the garbage collector will collect them when they are no longer used). Additionally, since dependencies are explicit, and are imported locally to each module, debugging can become less of a chore: there's only so many things a module can break, especially when taking care not to access the global environment unnecessarily from inside the module. cmodule also provides a stack trace for module compiler errors, making it much easier to track down typos or malformed code. Also, cmodule provides a way to load application data/code in an optionally sandboxed environment (using the cload function), which allows you to safely expose only the data and functions necessary for the data file to do it's job (since, after all, the data files <em>are</em> Lua files).</p>

<p>My main motivation for cmodule is that I feel like it worth taking a stab to try and coordinate efforts for sharing code in a more standardized manner, and a module loading system can be excellent for that, if adoption becomes common (for example, it makes it much easier create shared code libraries, application/template installers, and many other things). This is my attempt at that. I fully do not expect anyone to adopt cmodule, especially in it's early state, however I am cautiously optimistic that at least a few others will find value in both the cmodule's methodology and the actual implementation itself. It is usually my goal when hacking in Codea to provide features that TLL will hopefully find useful enough to one day include in Codea itself (either in it's Lua form or in a native form), thus I want to solicit feedback and get opinions on the idea and the execution itself. At the very least, I hope this can be educational/informative to others; there are a couple of neat tricks in there that are afforded by Lua's seemingly infinite expressiveness, and you might just learn something you didn't know from examining the code :)</p>

<p>This weekend I will move cmodule to a proper github repo (though I'll still keep an updated Codea-packaged copy in gist at the above links) and take a stab at some proper documentation. Some of the cooler features of cmodule are not obvious, and I want to make sure to get them documented so that they may be taken advantage of.</p>

<p>A note about cmodule file format:
Due to the fact that Codea automatically loads and executes all tabs within a project and it's dependency projects, module files must currently be wrapped in a long comment to prevent Codea from executing the code prematurely. Eventually Codea will support optional tab execution, and this will no longer be necessary, but for now cmodule must exist with this slightly annoying wart. As a concession, cmodule allows you to use whichever form of long comment you want, to alleviate issues with nested block comments. For example, you can use:</p>

<pre><code>--[[

-- module code goes here

--]]

</code></pre>

<p>or:</p>

<pre><code>--[=[

-- module code goes here

--[[
a nested long comment
--]]

--]=]
</code></pre>

<p>Essentially, you may choose to use as many = characters in your wrapper comment, and cmodule will respond accordingly.</p>
]]></description>
   </item>
   <item>
      <title>File IO functionality for Documents and Dropbox</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2810/file-io-functionality-for-documents-and-dropbox</link>
      <pubDate>Sun, 19 May 2013 22:42:26 -0400</pubDate>
      <dc:creator>michaelmaguin</dc:creator>
      <guid isPermaLink="false">2810@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I really would like some actual lua file io functionality within the codea dev environment would be really nice.</p>
]]></description>
   </item>
   <item>
      <title>Hmm... I can&#039;t quite place it. Spam maybe?</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2728/hmm-i-can-t-quite-place-it-spam-maybe</link>
      <pubDate>Tue, 07 May 2013 03:50:14 -0400</pubDate>
      <dc:creator>Zoyt</dc:creator>
      <guid isPermaLink="false">2728@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Someone (@Macdougal) really wants us to buy some jewelry. How nice of him to offer suggestions. Yes, we have more spammers. Yipee! Just kidding.<br />
<a rel="nofollow" href="/Codea/Talk/profile/Simeon">@Simeon</a></p>
]]></description>
   </item>
   <item>
      <title>Ray Tracing Shader</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2787/ray-tracing-shader</link>
      <pubDate>Wed, 15 May 2013 16:22:48 -0400</pubDate>
      <dc:creator>spacemonkey</dc:creator>
      <guid isPermaLink="false">2787@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Here's a fairly pointless curiosity.  I can't claim anything in it as mine, it's a webgl one I found somewhere and ported into Codea.</p>

<pre><code>-- RayTracer 3Balls

-- Use this function to perform your initial setup
function setup()
    displayMode(FULLSCREEN)
    myMesh = mesh()
    --myMesh.shader = shader("Documents:ray")
    myMesh.shader = shader(rayShader.vertexShader, rayShader.fragmentShader)
    aVPosBuffer = myMesh:buffer("aVertexPosition")
    aPPosBuffer = myMesh:buffer("aPlotPosition")

    aVPosBuffer:resize(6)
    aPPosBuffer:resize(6)
    size = 0.8 -- 1.0 is fullscreen
    aVPosBuffer[1] = vec2(size,size)
    aVPosBuffer[2] = vec2(-size,size)
    aVPosBuffer[3] = vec2(size,-size)
    aVPosBuffer[4] = vec2(size,-size)
    aVPosBuffer[5] = vec2(-size,size)
    aVPosBuffer[6] = vec2(-size,-size)

    t=0
    s1 = vec3(0,0,0)
    s2 = vec3(0,0,0)
    s3 = vec3(0,0,0)
end

function calcCamera()
    cameraFrom = vec3(math.sin(t*0.4)*28, math.sin(t*0.13)*5+5, math.cos(t*0.4)*28)
    cameraTo = vec3(0,0,0)
    cameraPersp = 6
    up = vec3(0,1,0)
    cameraDir = (cameraTo - cameraFrom):normalize()

    cameraLeft = cameraDir:cross(up):normalize()
    cameraUp = cameraLeft:cross(cameraDir):normalize()
    cameraCenter = cameraFrom + cameraDir * cameraPersp

    ratio = WIDTH/HEIGHT
    cameraTopLeft = cameraCenter + cameraUp + cameraLeft * ratio
    cameraBotLeft = cameraCenter - cameraUp + cameraLeft * ratio
    cameraTopRight = cameraCenter + cameraUp - cameraLeft * ratio
    cameraBotRight = cameraCenter - cameraUp - cameraLeft * ratio
    aPPosBuffer[1] = cameraTopRight
    aPPosBuffer[2] = cameraTopLeft
    aPPosBuffer[3] = cameraBotRight
    aPPosBuffer[4] = cameraBotRight
    aPPosBuffer[5] = cameraTopLeft
    aPPosBuffer[6] = cameraBotLeft    
end

function calcBalls()
    s1.x = math.sin(t * 1.1) * 1.5
    s1.y = math.cos(t * 1.3) * 1.5
    s1.z = math.sin(t + math.pi/3) * 1.5
    s2.x = math.cos(t * 1.2) * 1.5
    s2.y = math.sin(t * 1.4) * 1.5
    s2.z = math.sin(t*1.25 - math.pi/3) * 1.5
    s3.x = math.cos(t * 1.15) * 1.5
    s3.y = math.sin(t * 1.37) * 1.5
    s3.z = math.sin(t*1.27) * 1.5
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(0, 0, 0)

    calcBalls()

    calcCamera()

    myMesh.shader.cameraPos = cameraFrom
    myMesh.shader.sphere1Center = s1
    myMesh.shader.sphere2Center = s2
    myMesh.shader.sphere3Center = s3

    myMesh:draw()

    t = t + 0.03
    if t&gt; math.pi * 200 then
        t = t - math.pi * 200
    end
end

rayShader = {
vertexShader = [[
attribute vec2 aVertexPosition;
attribute vec3 aPlotPosition;

varying vec3 vPosition;

void main(void)
{
gl_Position = vec4(aVertexPosition, 1.0, 1.0);
vPosition = aPlotPosition;
}
]],
fragmentShader = [[
     precision highp float;

const vec3 lightDir = vec3(0.577350269, 0.577350269, -0.577350269);
varying vec3 vPosition;
uniform vec3 cameraPos;
uniform vec3 sphere1Center;
uniform vec3 sphere2Center;
uniform vec3 sphere3Center;

bool intersectSphere(vec3 center, vec3 lStart, vec3 lDir,
out float dist) {
vec3 c = center - lStart;
float b = dot(lDir, c);
float d = b*b - dot(c, c) + 1.0;
if (d &lt; 0.0) {
dist = 10000.0;
return false;
}

dist = b - sqrt(d);
if (dist &lt; 0.0) {
dist = 10000.0;
return false;
}

return true;
}

vec3 lightAt(vec3 N, vec3 V, vec3 color) {
vec3 L = lightDir;
vec3 R = reflect(-L, N);

float c = 0.3 + 0.4 * pow(max(dot(R, V), 0.0), 30.0) + 0.7 * dot(L, N);

if (c &gt; 1.0) {
return mix(color, vec3(1.6, 1.6, 1.6), c - 1.0);
}

return c * color;
}

bool intersectWorld(vec3 lStart, vec3 lDir, out vec3 pos,
out vec3 normal, out vec3 color) {
float d1, d2, d3;
bool h1, h2, h3;

h1 = intersectSphere(sphere1Center, lStart, lDir, d1);
h2 = intersectSphere(sphere2Center, lStart, lDir, d2);
h3 = intersectSphere(sphere3Center, lStart, lDir, d3);

if (h1 &amp;&amp; d1 &lt; d2 &amp;&amp; d1 &lt; d3) {
pos = lStart + d1 * lDir;
normal = pos - sphere1Center;
color = vec3(0.0, 0.0, 0.9);
}
else if (h2 &amp;&amp; d2 &lt; d3) {
pos = lStart + d2 * lDir;
normal = pos - sphere2Center;
color = vec3(0.9, 0.0, 0.0);
}
else if (h3) {
pos = lStart + d3 * lDir;
normal = pos - sphere3Center;
color = vec3(0.0, 0.9, 0.0);
}
else if (lDir.y &lt; -0.01) {
pos = lStart + ((lStart.y + 2.7) / -lDir.y) * lDir;
if (pos.x*pos.x + pos.z*pos.z &gt; 30.0) {
return false;
}
normal = vec3(0.0, 1.0, 0.0);
if (fract(pos.x / 5.0) &gt; 0.5 == fract(pos.z / 5.0) &gt; 0.5) {
color = vec3(1.0);
}
else {
color = vec3(0.0);
}
}
else {
return false;
}

return true;
}

void main(void)
{
vec3 cameraDir = normalize(vPosition - cameraPos);

vec3 p1, norm, p2;
vec3 col, colT, colM, col3;
if (intersectWorld(cameraPos, cameraDir, p1,
norm, colT)) {
col = lightAt(norm, -cameraDir, colT);
colM = (colT + vec3(0.7)) / 1.7;
cameraDir = reflect(cameraDir, norm);
if (intersectWorld(p1, cameraDir, p2, norm, colT)) {
col += lightAt(norm, -cameraDir, colT) * colM;
colM *= (colT + vec3(0.7)) / 1.7;
cameraDir = reflect(cameraDir, norm);
if (intersectWorld(p2, cameraDir, p1, norm, colT)) {
col += lightAt(norm, -cameraDir, colT) * colM;
}
}

gl_FragColor = vec4(col, 1.0);
}
else {
discard;
//gl_FragColor = vec4(0.0, 0.0, 0.0, 1.0);
}
}]]
}
</code></pre>
]]></description>
   </item>
   <item>
      <title>Spritely to Dropbox</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2803/spritely-to-dropbox</link>
      <pubDate>Sat, 18 May 2013 12:17:32 -0400</pubDate>
      <dc:creator>JakAttak</dc:creator>
      <guid isPermaLink="false">2803@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>If any of you use the Spritely example program for images, here is a quick little program that saves an image made in Spritely to your Dropbox</p>

<pre><code><br />--# Main
-- SpritelyToDropbox

-- Use this function to perform your initial setup
function setup()
    print("Hello World!")
    aloader = SpritelyLoader()

    -- Change "YourImageNameHere" to the name of your image
    Name = "YourImageNameHere"
end

-- This function gets called once every frame
function draw()
    -- This sets a dark background color 
    background(40, 40, 50)

    -- This sets the line thickness
    strokeWidth(5)

    -- Do your drawing here
    createImage = loadstring( readProjectData(Name))
    anImage = createImage() 

    saveImage("Dropbox:"..Name, anImage)

    -- Quits program as soon as image is saved
    close()

end


--# SpritelyLoader
SpritelyLoader = class()

-- SpriteLoader 
-- ver. 1.0
-- moves data from global to project storage
-- ====================

-- This class takes data from global and dumps it into your project.
-- 
-- To use this class, create an instance in your project.
-- For example:  aloader = SpritelyLoader()
--
-- This call will read both keys and images from the global Spritely
-- storage and copy them into your project space. 
--
-- Once in the project data, load the saved string to 
-- an image using it's key.  For example:
--
-- createImage = loadstring( readProjectData("bob"))
-- anImage = createImage() 

-- To display your images, you'll need to load them into
-- a sprite. The command looks like this

-- sprite(anImage, 100, 100, 32, 32)

-- Good luck!

function SpritelyLoader:init()
    local keys, k, s
    if readGlobalData("SpritelyKeys") == nil then
        print("No Spritely data found.")
    else
        -- read global keys
        keys = readGlobalData("SpritelyKeys")
        saveProjectData("SpritelyKeys", keys)
        print("Moving...")
        for k in string.gmatch(keys,"([^,]+)") do
            print(k)
            s = readGlobalData(k)
            saveProjectData(k, s)
        end
        print("Move complete.")
    end

end
</code></pre>

<p>Just change Name =  "YourImageNameHere" to your image name and after running the program sync your Dropbox from within Codea</p>

<p>Also note, if you want it to save to documents just change saveImage("Dropbox:") to saveImage("Documents:") 
The program is supposed to close as soon as the image is saved so do not be alarmed when it quits, the image should have been saved</p>

<p>Enjoy!</p>
]]></description>
   </item>
   <item>
      <title>3D Forest</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2742/3d-forest</link>
      <pubDate>Thu, 09 May 2013 00:59:38 -0400</pubDate>
      <dc:creator>Ignatz</dc:creator>
      <guid isPermaLink="false">2742@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>As an extension of my 3D town, I've created a 3D forest with 200 trees created from 7 distinct tree images placed in random positions and with random sizes. Codea handles the animation pretty well</p>

<p></p><div class="Video"><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/hL3mkG1RxeY&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed src="http://www.youtube.com/v/hL3mkG1RxeY&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" width="640" height="385" /></object></div>

<p>You should be wondering why, as I walk around the forest, you never see the images side on, because, after all, they are just flat 2D images. The answer is that I rotate the images - all 200 of them - so they are always facing the viewer.</p>

<p>There is another problem with 3D rendering, which is that if you draw objects in front before those behind, you get bad results. You should always try to draw objects in order, from furthest to nearest. So what I have done is sort the table holding the trees, in order of distance from the viewer. I only do this once a second, so as not to hammer the FPS too much. And what is my FPS? With just the buildings (see previous post), I'm up around 60 FPS, but the trees take it down to about 30.</p>

<p>This is the whole map, 2000 x 3000 pixels</p>

<p><a href="http://instagram.com/p/ZFCwWCBHb7/" target="_blank" rel="nofollow">http://instagram.com/p/ZFCwWCBHb7/</a></p>

<p>(and yes, that is a full size castle with battlements tucked away in the far right corner).</p>

<p>Now all I need is a couple of zombies, and I have an FPS  8-X</p>
]]></description>
   </item>
   <item>
      <title>Nevermind</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2813/nevermind</link>
      <pubDate>Mon, 20 May 2013 05:44:12 -0400</pubDate>
      <dc:creator>negedkid</dc:creator>
      <guid isPermaLink="false">2813@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>turns out there was a shared problem with the texcoord offset</p>
]]></description>
   </item>
   <item>
      <title>Shared: option to pass parameters as a simple list or as named parameters</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2812/shared%3A-option-to-pass-parameters-as-a-simple-list-or-as-named-parameters</link>
      <pubDate>Mon, 20 May 2013 02:42:35 -0400</pubDate>
      <dc:creator>Ignatz</dc:creator>
      <guid isPermaLink="false">2812@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Some of my functions have a long list of parameters, and it is easy to make mistakes when setting them. It would be nice to have the option to use named parameters, especially when I only want to set a couple of them.</p>

<p>The code below allows you to provide either a simple list of (unnamed) parameters, or a named list, in a table. Your function then only needs a single extra line of code to call the Params function to unpack the parameters correctly, by providing a list of the parameter names in the correct order.</p>

<p>Suggestions and improvements welcomed.</p>

<pre><code>function setup()
    --this is how you'd normally do it
    Test1(11,22,nil,44,55)

    --this is my proposed approach, allowing named parameters as well
    --both alternatives below give the same result
    --(a) pass parameters as simple list, in the correct order
    Test2(11,22,nil,44,55)
    --(b) pass only the named parameters we want, in any order
    Test2({stealth=55,health=11,dexterity=44,strength=22}) --strength omitted
end

--usual function requires a list in the right order
function Test1(h,s,d,m,t)
    print(h,s,m,d,t)  --test result
end

--this function allows named parameters as well
function Test2(...)
    --unpack the parameters, using the names to sort them correctly
    --this is the only extra line you need in your function
    local h,s,m,d,t=Params({"health","strength","magic","dexterity","stealth"},arg) 
    print(h,s,m,d,t)  --test result
end

function Params(list,tbl) --tbl is params
    if type(tbl[1])=="table" then --was named table
        local t={} --match the named params with the list provided
        for n,v in pairs(tbl[1]) do
            for i=1,#list do
               if n==list[i] then t[i]=v break end 
            end     
        end  
        return unpack(t)
    else --was an unnamed list, return it as is
       return unpack(tbl) 
    end
end
</code></pre>
]]></description>
   </item>
   <item>
      <title>Codea Competition: Survival games</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2805/codea-competition%3A-survival-games</link>
      <pubDate>Sat, 18 May 2013 13:51:55 -0400</pubDate>
      <dc:creator>Zoyt</dc:creator>
      <guid isPermaLink="false">2805@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hello,<br />
There has been a microscopic ammount of interest in a Codea Competition, so I thought it wouldn't hurt to host one. Here we go:<br />
Theme: Survival games
Make a game where the player has to last as long as possible without loosing or dying. Some examples of these are Jet Pack Joy Ride, Snake, Missile Defense, Crabitron, etc. Some Codea-made examples are TouchLine and Big Bigger, which could be entered into the competition.<br />
Rules:<br />
 • I suggest that the game has a start, game, and loosing screen.<br />
 • Make it look pretty. A large part of what makes a game good is its effects and graphics. 3D is even better.<br />
 • Please do not copy other games exactly. If you aren't inspired, give the game concept a new twist.<br />
 • The game shouldn't crash.<br />
 • The game should either be locked to one orientation, or resize in landscape and portrait orientation.<br />
 • The game should look or be complete.<br />
 • You may work with others, just let me know who else you worked with.<br />
 • Feel free to make a development thread. People love to see what others are working on.<br />
 • Enter your entry by June 7. I will release my verdict and feedback on all the code and give away the prizes on June 10.</p>

<p>How to enter:<br />
There are a few ways to enter your app.<br />
1. If your app is already on the App Store and is free, then give me a link to it.<br />
2. If you app is on the App Store and is paid, send me a redemption code for it.<br />
3. If you have the code for your game, but it isn't on the App Store, then you can email the code to zoyt12 (at) gmail (dot) com.<br />
4. You can also send me a private message to me with the code in it or a conversation thread with the code in it.<br />
If you have the game in code form, please send me the name of the game.</p>

<p>Entries:<br />
I will post the name of the game and the creator here when I get some entries.</p>

<p>Prizes:<br />
First:<br />
$20 at thatdevelopermarketplace.com<br />
Second:<br />
2 weeks of ad space at thatdevelopermarketplace.com</p>

<p>Please throw in a little something for prizes. It could be anything worthwhile, wether it's a snippet of code or a redemption code for your app. PM me anything you would be willing to throw in.</p>

<p>Thanks, and good luck!</p>
]]></description>
   </item>
   <item>
      <title>Indie Game Blog - Tutorials &amp; More</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2801/indie-game-blog-tutorials-more</link>
      <pubDate>Sat, 18 May 2013 04:13:58 -0400</pubDate>
      <dc:creator>ThermoApps</dc:creator>
      <guid isPermaLink="false">2801@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Indie game blog @ <a href="http://thatdevelopermarket.com/?page_id=365" target="_blank" rel="nofollow">http://thatdevelopermarket.com/?page_id=365</a></p>

<p>We blog about games &amp; Development, 
If you want us to post about your new game, Don't be shy... We're indies too!</p>

<p>Some of our favourite articles:
Learn to program in iOS Lesson 1 : <a href="http://thatdevelopermarket.com/?p=453" target="_blank" rel="nofollow">http://thatdevelopermarket.com/?p=453</a>
The Pschology of game development: Attractong customers like corporates - <a href="http://thatdevelopermarket.com/?p=392" target="_blank" rel="nofollow">http://thatdevelopermarket.com/?p=392</a></p>

<p>If you'd like to submit some codea tuts to us, I'd be more than delighted to put them up, I'll also include all your links and data. 
For the store we have over 400 visitors per week, It's great to attract some attention to show how powerful codea actually is!</p>

<p>All the best,
Jack :-)</p>
]]></description>
   </item>
   <item>
      <title>Long-Press Event Detection</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2806/long-press-event-detection</link>
      <pubDate>Sat, 18 May 2013 16:52:00 -0400</pubDate>
      <dc:creator>BrianH</dc:creator>
      <guid isPermaLink="false">2806@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hi all, my current project was in need of a way to detect when the user long-presses an object on the screen.  I didn't see much in the forums and wanted to share the following code in the hopes it saves others the time of recreating this functionality.  Please, if anyone has ANY suggestions on improving my code, please share!  I'm always interested in the way others solve similar problems.</p>

<p>In my code I break out the various touch states (BEGAN, MOVING, ENDED) which is why the touched() method forwards calls to one of the following:</p>

<pre><code>    touchesBegan(),  touchesMoved()  and   touchesEnded()
</code></pre>

<p>For my project I needed an onLongPress() method to be called every time the user touches and holds the screen for a given time.  My code uses a global 'longPressDuration' which by default is set to 1/2 a second (0.5).  This is the only variable that should be changed if you need longer or shorter long-press durations.  All of the variables that begin with 2 underscores '__' are used internally and should not be changed as they're used to maintain the state of the long-press event detection logic.</p>

<p>Basically the algorithm works like this:  when the user first touches the screen (touch.state == BEGAN), we store the current ElapsedTime so we can later check to see how long it's been since the user began touching the screen.  If the user moves their finger, then the long-press is cancelled.  Since the only method Codea calls regualrly is draw(), I placed all the logic for detecting a long press at the END of draw().  This code first checks to see if we've detected a touch BEGAN event.  If so, and we've yet to detect a long-press then we check the current time with the stored time when the touch BEGAN.  If this result is greater than the long-press hold time (longPressDuration) then we trigger the onLongPress() method.  You might notice the extra flags &amp; checking, these ensure that once the system has detected a long-press, it doesn't keep sending out the onLongPress() method on every draw() cycle.</p>

<p>Enough talk, here's the code.  Share &amp; enjoy</p>

<pre lang="lua">
--[[ 
  LongPress Event Detection

  Sample code to detect when a user long-presses/touches the screen.

  Since Codea doesn't provide timers or multiple threads, long-press
  detection is done in the only method that's called regularly, the
  'draw()' method.

  Also, Once a long-press has been detected, no more movement of the touch
  will be forward (touch.state == MOVING or ENDED).  Only after the user
  releases their finger from the screen will the long-press be cleared and
  touches will begin to be recognized again.

]]--



-- ----------------------------------------------------------------------------------
-- GLOBALs
-- ----------------------------------------------------------------------------------

-- how long does it take before a long-press event is triggered.
longPressDuration = 0.5


-- Sensitivity of the touch movement in points.
-- The number of points a touch can move to still allow a long-press.
-- users tend to 'jiggle' their fingers when long-pressing the screen,
-- this helps to make a long-press more accurate.
longPressSensitivity = 10




-- !! THE FOLLOWING ARE USED FOR STATE MANAGEMENT AND DO NOT NEED TO BE MODIFIED
-- touch start time
__longPressStartTime = 0

-- did we detect a touch.state == BEGAN?
__longPressStarted = false

-- has a long-press been detected?
__longPressDetected = false


-- store the touch BEGAN location
-- these are used to calculate the distance between
-- the touch start and the longPressSensitivity value
__longPressTouchX = 0
__longPressTouchY = 0




-- ----------------------------------------------------------------------------------
-- draw()
-- ----------------------------------------------------------------------------------
function draw()
    
    -- &lt;&lt;&lt; ADD YOUR DRAW CODE HERE &gt;&gt;&gt;
    
    
    -- The following code goes AFTER all drawing is completed.
    -- Basically, if we've detected a BEGAN touch event and
    -- a long-press hasn't been detected yet, check how long it's
    -- been since the touch started.  If it's longer than the long-press
    -- duration then trigger a long-press event.
    if __longPressStarted then
        if not __longPressDetected then
            if (ElapsedTime - __longPressStartTime) &gt; longPressDuration then
                __longPressDetected = true
                onLongPress()
            end
        end
    end
end



-- ----------------------------------------------------------------------------------
-- touched()
--
-- When the user touches the screen, this method processes the touch event
-- and routes the different touch types to their own method.  If a touch BEGAN
-- event is received, then setup a long-press/touch state.  If a MOVING touch
-- state is received, and the distance between the start of a long-press and
-- the current 'moving' touch is less than the long-press sensitivity then
-- ignore the MOVING touch, otherwise cancel the long-press and just trigger a
-- MOVING event. 

-- Once a long-press/touch has been detected, ALL future touch events are IGNORED
-- until the user removes their finger from the screen, which triggers an ENDED
-- touch state.  Once this happens, the long-press state is reset and touches
-- are enabled once again.
-- ----------------------------------------------------------------------------------
function touched(touch)
    if touch.state == BEGAN then
        __longPressStartTime = ElapsedTime
        __longPressStarted = true
        __longPressTouchX = touch.x
        __longPressTouchY = touch.y
        touchesBegan(touch)

    elseif touch.state == MOVING then
        if not __longPressDetected then
            -- has the touch moved outside of the long-press sensitivty range?
            if not distanceWithinRange(touch.x, touch.y, __longPressTouchX, __longPressTouchY, longPressSensitivity) then
                -- cancel the long-press state...
                __longPressStarted = false
                -- send a touchesMoved() event...
                touchesMoved(touch)
            end
        end    
    else
        -- This is for touch.state == ENDED 
        if not __longPressDetected then
            touchesEnded(touch)
        end
        
        -- clear the long-press flags
        __longPressDetected = false
        __longPressStarted = false
    end
end


-- ----------------------------------------------------------------------------------
-- distanceWithinRange()
--
-- Given 2 points calculate their distance for both X and Y.
-- If the distance of BOTH X and Y are less than distanceRange
-- then return 'true', otherwise return 'false'
--
-- Params:
--            p1x, p1y       First point to check
--            p2x, p2y       Second point to check
--            distanceRange  Minimum distance between p1 and p2 to check for
--
-- Return:
--            true        Distance between p1 AND p2 is less than or equal to'distanceRange'
--            false       Distance between p1 AND p2 is greater than 'distanceRange'
-- ----------------------------------------------------------------------------------
function distanceWithinRange(p1x, p1y, p2x, p2y, distanceRange)
    local result = false
    
    -- calculate the distance between p1 and p2
    local dx = math.abs(p2x-p1x)
    local dy = math.abs(p2y-p1y)
    
    -- if the distance between BOTH p1 and p2 is less than or equal todistanceRange
    -- then set result to 'true', otherwise result will be the default value
    -- of 'false'
    if dx </pre>
]]></description>
   </item>
   <item>
      <title>Interesting - a Codea programming workshop held recently</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2809/interesting-a-codea-programming-workshop-held-recently</link>
      <pubDate>Sun, 19 May 2013 05:20:09 -0400</pubDate>
      <dc:creator>Ignatz</dc:creator>
      <guid isPermaLink="false">2809@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p><a href="http://dcdoolan.wordpress.com/2013/05/14/ipads-galore-codea-ipad-programming-workshop/" target="_blank" rel="nofollow">http://dcdoolan.wordpress.com/2013/05/14/ipads-galore-codea-ipad-programming-workshop/</a></p>
]]></description>
   </item>
   <item>
      <title>thoughts on saveLocalData</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2808/thoughts-on-savelocaldata</link>
      <pubDate>Sun, 19 May 2013 01:32:09 -0400</pubDate>
      <dc:creator>se24vad</dc:creator>
      <guid isPermaLink="false">2808@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>hey folks,
I somewhat guessed it but now tested and found out, that saveLocalData saves information under a "global" key. Which means, saving information from class instances(!), causes the key to get overriden!</p>

<p>What are your thoughts - how could this problem be solved in an elegant way?
My first idea would be to save all instances in a table and save this table to LocalData. Any other ideas? Any suggestions how to approach this?</p>
]]></description>
   </item>
   <item>
      <title>How do you hide a sprite in codea?</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2807/how-do-you-hide-a-sprite-in-codea</link>
      <pubDate>Sat, 18 May 2013 18:09:17 -0400</pubDate>
      <dc:creator>Elden123</dc:creator>
      <guid isPermaLink="false">2807@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I have no idea</p>
]]></description>
   </item>
   <item>
      <title>Loving Logitech FabricSkin Keyboard Folio</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2804/loving-logitech-fabricskin-keyboard-folio</link>
      <pubDate>Sat, 18 May 2013 13:19:27 -0400</pubDate>
      <dc:creator>Zoyt</dc:creator>
      <guid isPermaLink="false">2804@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hello,<br />
Yesterday I just got my Logitech FabricSkin Keyboard Folio for $150. I thought I might let you guys know if it's a good purchase for coding, because most keyboard reviews are not aimed for coders.<br />
Anyways, when I first open up the keyboard and set it up, it looked and acted amazing. When you link the iPad with the correct magnetic spot, the keyboard would automatically turn on. When you unlink it, it turns off. That way, when it is normal using mode (whith the keyboard part folded back), you don't have to worry about keys being pressed. This may sound like a slow process and a battery waister, but turning/connecting it on and off takes less than a second. The keyboard automatically pops up when you disconnect it. Goodbye power buttons.<br />
As for the battery, I'd say I've been using it about 8 hours already, without running out. It will probably take a month for it to run out.
There were some complaints about the keys being too far apart, but for me, it only took a few lines of code to get use to it. I usually type about 70-80 words per minute, and I'm at about 60 on here. On the normal iPad screen, I'm at about 35.<br />
Some users complained about the number keys being clumsy, but I'm not having a single issue. The keys are lined up at the top as home, 1-0,-,=, and delete.<br />
One of my only complaints that isn't really fixable is the tab. For certain keys, like the caps loc, tab, iOS specific function, ~, and ` you need to hold the "fn" key to access. That can be onoying when you have to use the tab key a lot. Thank heavens for automatic tabbing.
Typing in characters other languages is still easy on the keyboard just like on iOS. On iOS, you have to tap and holdon a letter to access a key in another language. On a keyboard, just like on the Mac, you press "alt" and a key that represents the type of cahracter, then press the character and you're done. For instance, here is my name in Spanish (it's original version): Natãn.<br />
My rating for this is a 4.9/5. If there was such a thing as a perfect keyboard, this is as close as you'll get.<br />
- Type on a Logitech FabricSkin Keyboard Folio<br />
Bonus - The keyboard is waterproof, but I haven't tried that out, and I don't plan to.</p>
]]></description>
   </item>
   <item>
      <title>StatusBar - FPS,Clock and Memory -Auto Installs</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2775/statusbar-fps-clock-and-memory-auto-installs</link>
      <pubDate>Tue, 14 May 2013 14:22:01 -0400</pubDate>
      <dc:creator>Briarfox</dc:creator>
      <guid isPermaLink="false">2775@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Simple Status Bar - <a href="https://gist.github.com/briarfox/5578242" target="_blank" rel="nofollow">https://gist.github.com/briarfox/5578242</a></p>

<p>I thought I'd share this. It was inspired from <a rel="nofollow" href="/Codea/Talk/profile/Jvm38">@Jvm38</a> and his Window library. Most of the code is his, I just edited it for my needs. This places a simple bar that can be dragged around the screen. It shows basic info that I like to see when I'm working on a project. The last location is saved and it can be toggled on and off.</p>

<p>I would also like feedback on the installer. Simply copy into main, set the name of the project you created and run it twice. All the code will be there. You can delete the json file when done, I haven't added to code to remove it yet.</p>

<p>Code if you prefer not to copy off gist</p>

<pre><code><br /><br />--StatusBar Single Install
--Installer created by <a rel="nofollow" href="/Codea/Talk/profile/acp">@acp</a> edited by <a rel="nofollow" href="/Codea/Talk/profile/Briarfox">@Briarfox</a>
--- This will pull the StatusBar project into Codea for you
-- Instructions:
-- * Create a new project in Codea named StatusBar If you chose another name please change the variable Below
--This is case sensitive
ProjectName = "StatusBar"
-- * Paste this into the Main (not from the raw view, as iSafari will escape special characters)
-- * Run, run again, 
-- If all went well, you should have a StatusBar project now



function getJsonLib()
    local tabs = listProjectTabs()
    if #tabs == 1 then
        print("Pulling JSON library into project...")
        local handleSuccess = function(data)
            saveProjectTab("json", data)
            sound(SOUND_POWERUP, 42179)
            print("Success! Please relaunch this project")
        end
        http.request("<a href="https://dl.dropboxusercontent.com/s/9e4nvqeu4hsux2q/Json.lua?token_hash=AAFyMB98j4bnt_1gawf9wSke52hsoC7hsIvARcTuZNeOEw&amp;dl=1" target="_blank" rel="nofollow">https://dl.dropboxusercontent.com/s/9e4nvqeu4hsux2q/Json.lua?token_hash=AAFyMB98j4bnt_1gawf9wSke52hsoC7hsIvARcTuZNeOEw&amp;dl=1</a>", handleSuccess)
        return false
    else
        return true
    end
end

function setup()
    local handleSuccess = function(data,i,j)
        if listProjectTabs(ProjectName) == nil then
            sound(SOUND_EXPLODE, 32351)
            error("AutoGist project must exist first")
        end
        local gist = json.decode(data)
        local projName = ProjectName
        for k,v in pairs(gist.files) do
            local name = projName .. ":" .. string.gsub(k,".lua","")
            saveProjectTab(name, v.content)
        end
        sound(SOUND_PICKUP, 11797)
        print("Success!")
    end
    local handleFailure = function(data)
        sound(SOUND_EXPLODE, 32351)
        print(data)
    end
    if getJsonLib() then
    http.request("<a href="https://api.github.com/gists/5578103" target="_blank" rel="nofollow">https://api.github.com/gists/5578103</a>",handleSuccess, handleFailure)
    end
end

</code></pre>
]]></description>
   </item>
   <item>
      <title>Need Some Help (A Beginner&#039;s Request)</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2487/need-some-help-a-beginner-s-request</link>
      <pubDate>Thu, 21 Mar 2013 09:32:13 -0400</pubDate>
      <dc:creator>Steven</dc:creator>
      <guid isPermaLink="false">2487@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hello guys, 
I'm Not A Good Programmer, but Codea helped me to like programming. Suddenly, something has gone wrong because I tried to do something apparently quite easy. I want to do a animated background with a pattern like in Cargo-Bot game. 
This is the pattern: 
<a rel="nofollow" href="http://postimg.org/image/68dsrwkjd/" target="_blank"><img src="http://s4.postimg.org/68dsrwkjd/Picture.jpg" alt="Picture" style="border: 0px;" /></a>
<a rel="nofollow" href="http://postimg.org/image/5on96d0qz/" target="_blank"><img src="http://s9.postimg.org/5on96d0qz/cargo_bot.jpg" alt="cargo bot" style="border: 0px;" /></a>
Can you help me with a code?</p>
]]></description>
   </item>
   <item>
      <title>math.probablity</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2802/math-probablity</link>
      <pubDate>Sat, 18 May 2013 07:39:08 -0400</pubDate>
      <dc:creator>Saurabh</dc:creator>
      <guid isPermaLink="false">2802@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Is there a way to set probablity between two things? Let say I want one photo to pop 80% of the times and another one to pop 20% of the times. Is there a shortcut to do so. I've written this code but it'll be better if there's a shorter way.</p>

<pre><code><br />--# Main

--# Main
function setup()
    photo = {}
    photo[1] = readImage("Cargo Bot:Codea Icon")
    photo[2] = readImage("Cargo Bot:Codea Logo")
    t = 5
    i = 1
    previousi = 1
    twop = 0
    onep = 0
    parameter.watch("percenttwo")
end

function draw()
    background(255, 255, 255, 255)
    t = t-1
    if t==0 then
        i = math.random(1,10)
        if i==previousi then t=1 else
            t = 5
            previousi = i
        end
    end
    if i&lt;=8 then
        p = 1
        onep = onep+1
    elseif i&gt;8 then
        p = 2
        twop = twop+1
    end
    percenttwo = (twop/(twop+onep))*100
    sprite(photo[p],WIDTH/2,HEIGHT/2)
end

</code></pre>
]]></description>
   </item>
   <item>
      <title>Detecting when app/script is shutdown</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2745/detecting-when-app-script-is-shutdown</link>
      <pubDate>Thu, 09 May 2013 14:55:16 -0400</pubDate>
      <dc:creator>BrianH</dc:creator>
      <guid isPermaLink="false">2745@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hi all,</p>

<p>I've decided to give Codea a try and found an issue I can't resolve.  Simply put, does Codea notify the running script that the user has pressed the home button or that the app has transitioned to the background?  This is assuming the script was exported to xCode and compiled to a native app.   Is there an equivalent to 'applicationWillResignActive'  or 'applicationDidEnterBackground'?  I'm an experienced iOS developer and would rather use Codea than Objective-C for quick app ideas.</p>

<p>I ask because in my app I would like to save the current data (tables) so the user doesn't have to re-create the data each time they run the app (assuming I've exported the app to xCode).  I've looked at serializing the table structures after each change is made, but that's a lot of overhead which I'd rather push to a 'shutdown()' method if possible.</p>

<p>Thanks for any suggestions!</p>

<p>-Brian</p>
]]></description>
   </item>
   <item>
      <title>Random photos code</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2797/random-photos-code</link>
      <pubDate>Fri, 17 May 2013 06:31:34 -0400</pubDate>
      <dc:creator>Mohammad_abumoosa</dc:creator>
      <guid isPermaLink="false">2797@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Pleas i want a code to help me take a random pictures to play on it</p>

<p>Random photo code</p>
]]></description>
   </item>
   <item>
      <title>iPad resolution</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2800/ipad-resolution</link>
      <pubDate>Fri, 17 May 2013 21:27:19 -0400</pubDate>
      <dc:creator>dreamergb</dc:creator>
      <guid isPermaLink="false">2800@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Since I use Codea to code my games, I do it on an iPad mini. Today, I got an iPad 4th generation Retina to test my games in 2048x1536 and I wanted to see the resolution in a test project using the print(WIDTH) and print(HEIGHT). I was surprised to see that it showed 1024x768 !!!!!!!!!! Codea does not seem to properly recognize the resolution!!! Any comments?</p>
]]></description>
   </item>
   <item>
      <title>How can I use collideConnected on a distance joint?</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2793/how-can-i-use-collideconnected-on-a-distance-joint</link>
      <pubDate>Thu, 16 May 2013 12:58:31 -0400</pubDate>
      <dc:creator>Neztec</dc:creator>
      <guid isPermaLink="false">2793@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I have two physics bodies that are connected by a distance joint. My problem is that i still want them to be able to collide (if the proper forces are applied to them). Some research on box2d says I should be able to set a collideConnected property to still allow that, despite being connected by a distance joint. It doesn't seem to work in Codea. Any ideas why doesn't work?</p>

<p>Any help is much appreciated!
- Mike</p>
]]></description>
   </item>
   <item>
      <title>Loving Codea</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/864/loving-codea</link>
      <pubDate>Tue, 24 Apr 2012 07:08:38 -0400</pubDate>
      <dc:creator>chevi</dc:creator>
      <guid isPermaLink="false">864@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I just got Codea today and I wanted to do some tests with it, so I decided to code a simple Chopper game (The usual of the chopper in the cave)
Preview of the game: <a href="http://p.twimg.com/ArPboRICEAAufUr.jpg" target="_blank" rel="nofollow">http://p.twimg.com/ArPboRICEAAufUr.jpg</a></p>

<p>After a couple hours I have a reasonably playable version (I will share the code when done), and several problems or doubts about Codea:</p>

<p>I know this has probably been discussed, but I couldn't find it, I've seen the Cargo-Bot game in the App Store, and I was wondering if there is a known process (hopefully simple) to export apps from Codea to the AppStore</p>

<p>Another thing is, Codea is great for games, but it doesn't really have many options to either interact with the user (Form creation for example), the iPad (more os functions) or the Internet. I would love to code some Apps for some of my websites, but right now Codea doesn't really provide the tools for that. Is it possible that the developers will add such features in future releases?</p>

<p>Thanks a lot!
Chevi</p>
]]></description>
   </item>
   <item>
      <title>Codea visual test: Attraction</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2799/codea-visual-test%3A-attraction</link>
      <pubDate>Fri, 17 May 2013 12:49:51 -0400</pubDate>
      <dc:creator>chevi</dc:creator>
      <guid isPermaLink="false">2799@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Hello,
I have (kind of) recently done a little visual experiment using Codea. I like colorful things that move and being bored one day I decided to code something that just did that.</p>

<p>The program draws several balls floating in a 2D space, the color depends on each ball's speed (blue to red, as speed increases)
You can tap anywhere to create a new attraction point (white circles) that slowly fades away until it dissappears. You can also drag attraction points to relocate them.</p>

<p>You can see it working here: </p><div class="Video"><object width="640" height="385"><param name="movie" value="http://www.youtube.com/v/QphvHa4SUNY&amp;hl=en_US&amp;fs=1&amp;" /><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><embed src="http://www.youtube.com/v/QphvHa4SUNY&amp;hl=en_US&amp;fs=1&amp;" type="application/x-shockwave-flash" width="640" height="385" /></object></div>

<p>And the source code: <a href="https://github.com/aurbano/Attraction" target="_blank" rel="nofollow">https://github.com/aurbano/Attraction</a></p>
]]></description>
   </item>
   <item>
      <title>How to creat a main menu with a select botton</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/1445/how-to-creat-a-main-menu-with-a-select-botton</link>
      <pubDate>Mon, 30 Jul 2012 08:15:23 -0400</pubDate>
      <dc:creator>Mohammad_abumoosa</dc:creator>
      <guid isPermaLink="false">1445@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Pleas can any one help me i want to creat a main menu with a select botton but i dont now what is the code and i want it 3 select bouttun firs eazy go to eazy game normal go normal game hard go to hard game i have a gift for the best answer</p>
]]></description>
   </item>
   <item>
      <title>Playback of MP3 files</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2796/playback-of-mp3-files</link>
      <pubDate>Fri, 17 May 2013 00:30:46 -0400</pubDate>
      <dc:creator>MrCoxall</dc:creator>
      <guid isPermaLink="false">2796@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I was just wondering if anyone knows why you cannot simply play back MP3 files in Codea?
It seems like a needed element in a programming language designed for games.
Is there some technical reason that it was excluded.</p>
]]></description>
   </item>
   <item>
      <title>Tween on object</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2798/tween-on-object</link>
      <pubDate>Fri, 17 May 2013 07:00:12 -0400</pubDate>
      <dc:creator>HyroVitalyProtago</dc:creator>
      <guid isPermaLink="false">2798@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Have you a solution for make something like this ? :</p>

<pre><code>example = {}
example.pos = {}
example.pos.x = 0
example.pos.y = 0
example.dim = {}
example.dim.w = 10
example.dim.h = 10

tween(2, example, {pos.x=10, dim.w=20})
-- or
tween(2, example, {pos["x"]=10, dim["w"]=20})
</code></pre>
]]></description>
   </item>
   <item>
      <title>Speed test game on codea</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2792/speed-test-game-on-codea</link>
      <pubDate>Thu, 16 May 2013 12:14:13 -0400</pubDate>
      <dc:creator>Saurabh</dc:creator>
      <guid isPermaLink="false">2792@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Just for practice, I wanted to repeat the game speed test on codea and I also did almost completely. Here's the link to the code <a href="https://gist.github.com/Saurabh96jun/5592958" target="_blank" rel="nofollow">https://gist.github.com/Saurabh96jun/5592958</a>. And to the video of the game <a href="http://m.youtube.com/watch?v=8GgJNVz8Ahw" target="_blank" rel="nofollow">http://m.youtube.com/watch?v=8GgJNVz8Ahw</a>. The hard and medium mode do much more than blinking those ellipses.</p>
]]></description>
   </item>
   <item>
      <title>Endless</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/852/endless</link>
      <pubDate>Sun, 15 Apr 2012 12:23:22 -0400</pubDate>
      <dc:creator>Mark</dc:creator>
      <guid isPermaLink="false">852@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I haven't been able to spend as much time coding lately as I would like, but I have been knocking around one project I hope to get out soon.</p>

<p>Endless is a "roguelike" adventure game where you troop through randomly generated levels facing... well, endless numbers of monsters, discovering endless keys, opening endless chests, and descending endless staircases to the next level.  Each level has a different sets of creatures, with difficulty that is always increasing. Likewise, weapons become more powerful and your character's abilities increase.</p>

<p>I've stripped the statistics down to a bare minimum (attack, defense, health) so at the moment there are no ranged weapons or magical attacks. I hope to work those in later.  At the moment, all the graphics come from standard sprite packs.  I'll improve on that with time, but don't really have plans to take this beyond the traditional 2D view..</p>

<p>Hopefully, I'll get an initial version out in the next week or so.  Soon you too can discover a Balanced Sword of Unyielding Vorpalness and face off with a Deadly Whispering Spider.</p>

<p>Suggestions are welcome.</p>

<p><a href="http://db.tt/m22Cd66f" target="_blank" rel="nofollow">http://db.tt/m22Cd66f</a></p>
]]></description>
   </item>
   <item>
      <title>Ballons game</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2701/ballons-game</link>
      <pubDate>Sat, 04 May 2013 08:02:32 -0400</pubDate>
      <dc:creator>Saurabh</dc:creator>
      <guid isPermaLink="false">2701@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>I had made a simple game a few days back (with the help of <a rel="nofollow" href="/Codea/Talk/profile/Ignatz">@Ignatz</a>) so I thought I would share with you'll.
Here's a video for the game
<a href="http://m.youtube.com/watch?v=hmX3cXXwlFI" target="_blank" rel="nofollow">http://m.youtube.com/watch?v=hmX3cXXwlFI</a>
And here's the code</p>

<pre><code>--# Main
-- do three tap finger to bring up buttons to exit no button mode
function setup()
    displayMode(FULLSCREEN_NO_BUTTONS)
    gameover = false
    Power = 0
    vy = HEIGHT + 6
    playing = false
    score = 0
    s = {}
    l = {}
    h = {}
    pow = {}
    p = 0
    lives = 5
    level = 1
    physics.pause()
    physics.gravity(0,0)
    bullets = {}
    misses = {}
    ball = {}
    for i = 1,5 do
        ball[i] = Ballons(level)
    end
    sound(DATA, "ZgNAUwAwQEBAYEpAvYbyPnuCCD8JSd8+WQBAf0BAQEBAbUBA")
    parameter.watch("#misses")
    parameter.watch("#ball")
    parameter.watch("score")
    parameter.watch("level")
end

function draw()
    if not playing then
    MainScreen()
    end
    if playing then
        background(255, 255, 255, 255)
        strokeWidth(2)
        stroke(81, 31, 31, 255)
        line(75,0,75,HEIGHT)
        physics.resume()


    if collision ~= nil then
        ball[collision[1]].ballon:destroy()
        table.remove(ball,collision[1])
        bullets[collision[2]]:destroy()
        table.remove(bullets,collision[2])
        collision=nil
        score = score + math.ceil(level/3)
    end

    pushStyle()
    fill(0, 0, 0, 255) -- drawing the bullets
    for i,b in pairs(bullets) do
        sprite("Documents:arrow",b.x - 37,b.y,74)
        if b.x&lt;1 or b.x&gt;WIDTH or b.y&lt;1 or b.y&gt;HEIGHT then
            table.remove(bullets,1,b)
            table.insert(misses,1)
        end
    end

    sprite("Documents:female",25,y - 34)
    for i,b in pairs(ball) do
        if b.ballon.y &gt; HEIGHT + b.radius then
            table.insert(misses,1)
            table.remove(ball,i,ball[i])
        end
        if b.ballon.x &gt; WIDTH + b.radius then
            table.remove(ball,i,ball[i])
        end
    end
    popStyle()

    for i,b in pairs(ball) do
        pushStyle()
        fill(b.colr)
        ellipse(b.ballon.x, b.ballon.y, b.radius*2)
    end
        popStyle()

    Misses()
    p = level*2
    table.insert(pow,1,p)
    table.insert(l,1,level)

    for i = 1,1000 do
        if level == 5*i then
            pushStyle()
            fontSize(25)
            font("MarkerFelt-Thin")
            fill(0, 203, 255, 255)
            text("improve arrow speed -- score cut =", WIDTH/2, HEIGHT/2)
            text(pow[1], WIDTH/2 + 179, HEIGHT/2)
            text("continue without the boost",WIDTH/2, HEIGHT/2-150)
            popStyle()
            PowerUp = true
            physics.pause()
        end
    end

    if #ball == 0 then
        level = level + 1
        table.remove(misses,1)
        for i = 1,5 + level/2  do
            ball[i] = Ballons(level)
        end  
    end

    pushStyle()
    fill(255, 28, 0, 255)
    lives = 5 - #misses
    table.insert(h,1,lives)
    table.insert(s,1,score)
    fontSize(20)
    text("Lives left   ", WIDTH - 103, HEIGHT - 50)
    text(h[1], WIDTH - 50, HEIGHT - 50)
    text("Score       ", WIDTH - 105, HEIGHT - 75)
    text(s[1], WIDTH - 50, HEIGHT - 75)
    text("Level        ", WIDTH - 103, HEIGHT - 100)
    text(l[1], WIDTH - 50, HEIGHT - 100)

    end
end

function touched(touch)
    x = touch.x
    y = touch.y
    if not playing then
        if touch.state == BEGAN then
            if x&gt;=WIDTH/2 - 30 and x&lt;=WIDTH/2 + 30 and y&gt;=HEIGHT/2 - 105 and y&lt;=HEIGHT/2 - 85 then
                playing = true
            end
        end
    end

    if x&lt;=75 and playing then
        if touch.state == BEGAN then
            createBullet()
        end
    end

    if PowerUp then
        if touch.x&gt;=WIDTH/2-200 and touch.x&lt;=WIDTH/2 + 200 and
           touch.y&lt;=HEIGHT/2 + 30 and touch.y&gt;=HEIGHT/2 - 30 then
            PowerUpBullets()
        end

        if touch.x&gt;=WIDTH/2-100 and touch.x&lt;=WIDTH/2 + 100 and
           touch.y&lt;=HEIGHT/2 - 120 and touch.y&gt;=HEIGHT/2 - 180 then
            PowerUp = false
            level = level + 1
            physics.resume()
        end
    end

    if gameover then
        if touch.x&gt;=WIDTH/2-100 and touch.x&lt;=WIDTH/2 + 100 and
           touch.y&lt;=vy - 10 and touch.y&gt;=vy - 90 then
            if touch.state == BEGAN then
                setup()
            end
        end
    end
end

function collide(contact) 
    if contact.bodyA.info~=nil and contact.bodyB.info~=nil then
        for i,v in pairs(ball) do
            if v.ballon==contact.bodyA or v.ballon==contact.bodyB then
                for j,bb in pairs(bullets) do
                    if bb==contact.bodyA or bb==contact.bodyB then
                        sound(DATA, "ZgNAXS4wQEBAQEBA/9iePiN3mD64nKs+cgBAf0BAQEBAb0BA  ")
                        collision={i,j}
                    end
                end
            end
        end
    end      
end
--# MainScreen
function MainScreen()
    background(255, 255, 255, 255)
    pushStyle()
    font("MarkerFelt-Thin")
    fontSize(25)
    fill(0, 199, 255, 255)
    text("no more than 5 lives", WIDTH - 380, HEIGHT - 50)
    text("waste an arrow or miss a balloon and lose a life", WIDTH - 250, HEIGHT - 75)
    popStyle()
    pushStyle()
    fontSize(100)
    font("SnellRoundhand-Black")
    fill(192, 26, 18, 117)
    text("BALLONS", WIDTH/2, HEIGHT/2)
    popStyle()
    pushStyle()
    font("MarkerFelt-Wide")
    fontSize(30)
    fill(0, 198, 255, 255)
    text("Start", WIDTH/2,HEIGHT/2 - 95)
    popStyle()
    pushStyle()
    font("MarkerFelt-Thin")
    fontSize(25)
    fill(0, 199, 255, 255)
    text("Touch behined this line to shoot arrows", 350, HEIGHT - 250)
    strokeWidth(3)
    stroke(0, 200, 255, 255)
    lineCapMode(ROUND)
    line(160,HEIGHT-250,75,HEIGHT-250)
    line(75,HEIGHT-250,85,HEIGHT-245)
    line(75,HEIGHT-250,85,HEIGHT-255)
    popStyle()
    pushStyle()
    strokeWidth(2)
    stroke(81, 31, 31, 255)
    line(75,0,75,HEIGHT)
    popStyle()
end
--# Ballons
Ballons = class()

function Ballons:init(l)
    self.lev = l
    self.radius = math.random(25,50)
    self.ballon = physics.body(CIRCLE,self.radius)
    self.ballon.x = math.random(150,WIDTH - self.radius)
    self.ballon.y = math.random(-HEIGHT/2,-self.radius)
    self.ballon.linearVelocity = vec2(0,math.random(50,50 + 10*self.lev))
    self.ballon.sensor = true
    self.ballon.info="ball"
    self.colr = c or color(math.random(255),math.random(255),math.random(255),math.random(100,150))
end
--# CreateBullet
function createBullet()
    local bullet = physics.body(CIRCLE,5)
    bullet.x = x
    bullet.y = y
    bullet.linearVelocity = vec2(750 + Power,0)
    bullet.restitution = 0
    bullet.type = DYNAMIC
    bullet.info = "bullet"
    table.insert(bullets,bullet)
end
--# GameOver
function Misses()
    if #misses &gt;= 5 then
        gameover = true
        vy = vy - 3
        pushStyle()
        fill(255, 0, 0, 255)
        font("HoeflerText-BlackItalic")
        fontSize(50)
        text("Game Over: Score", WIDTH/2, vy)
        if vy &lt;= HEIGHT/2 then
            vy = HEIGHT/2
        end
        if vy &gt;= HEIGHT then
            sound(DATA, "ZgBAKgBLQFRAQEBAAAAAAK5T+j46fh4/UwBAf0BAQEBAZEBA")
        end
        pushStyle()
        fill(255, 0, 0, 255)
        text(s[1] ,WIDTH/2 + 300, vy)
        popStyle()
        physics.pause()
        popStyle()
        pushStyle()
        fill(255, 0, 0, 255)
        fontSize(50)
        text("Restart", WIDTH/2 + 20, vy - 50)
        popStyle()
    end
end
--# PowerUpBullets
function PowerUpBullets()
    Power = 50*level
    PowerUp = false
    level = level + 1
    score = score - level*2 + 1
    physics.resume()
end
</code></pre>

<p><a href="https://www.dropbox.com/s/dnkd3aczm2eg082/Photo%20Apr%2027%2C%2011%2046%2033%20PM.jpg" target="_blank" rel="nofollow">https://www.dropbox.com/s/dnkd3aczm2eg082/Photo Apr 27, 11 46 33 PM.jpg</a> (arrow) and
<a href="https://www.dropbox.com/s/757dijs5c7gx334/Photo%20Apr%2027%2C%2011%2042%2014%20PM.jpg" target="_blank" rel="nofollow">https://www.dropbox.com/s/757dijs5c7gx334/Photo Apr 27, 11 42 14 PM.jpg</a> (female)</p>
]]></description>
   </item>
   <item>
      <title>YouTube videos for Codea instruction.</title>
      <link>http://www.twolivesleft.com/Codea/Talk/discussion/2795/youtube-videos-for-codea-instruction</link>
      <pubDate>Thu, 16 May 2013 17:39:58 -0400</pubDate>
      <dc:creator>Rockingmarvin</dc:creator>
      <guid isPermaLink="false">2795@/Codea/Talk/discussions</guid>
      <description><![CDATA[<p>Any one have any good links for real beginners of Codea?</p>
]]></description>
   </item>
   </channel>
</rss>