<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>That&#039;s So Panda &#124; Mobile Development and Corona SDK Tutorials</title>
	<atom:link href="http://thatssopanda.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://thatssopanda.com</link>
	<description>Bringing Games to a Phone Near You</description>
	<lastBuildDate>Thu, 16 May 2013 19:08:52 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5</generator>
		<item>
		<title>Create a Scrolling Background – Going Down!</title>
		<link>http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-down/</link>
		<comments>http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-down/#comments</comments>
		<pubDate>Mon, 13 May 2013 10:00:29 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Corona SDK Tutorials]]></category>
		<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2250</guid>
		<description><![CDATA[This post is an expansion on my previous post &#8211; Create a Scrolling Background Going Up! In the previous post, I walked you through creating a scrolling background that goes up and in today&#8217;s post, you&#8217;ll learn how to make the scrolling background move down. There are [...]]]></description>
				<content:encoded><![CDATA[<p>This post is an expansion on my previous post &#8211; <a href="http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-up/">Create a Scrolling Background Going Up!</a> In the previous post, I walked you through creating a scrolling background that goes up and in today&#8217;s post, you&#8217;ll learn how to make the scrolling background move down. There are very few changes to get this to work.</p>
<ol>
<li>Instead of subtracting the scroll speed, we will add it.</li>
<li>We changed the if-then statement to &gt; 1040</li>
<li>We changed the translate location to -960.</li>
</ol>
<p>Here&#8217;s the code to get a vertical scrolling background with Corona SDK.</p>
<p>Since we have a vertically scrolling background, I&#8217;ve changed the default and supported orientation to portrait instead of landscape.</p>
<p>Build.settings</p>
<pre class="wp-code-highlight prettyprint linenums:1">settings =
{
orientation =
{
default = &quot;portrait&quot;,

supported =
{
&quot;portrait&quot;,
},

},
}</pre>
<p>Everything in config.lua stays the same.</p>
<p>Config.lua</p>
<pre class="wp-code-highlight prettyprint linenums:1">-- config.lua
application =
{
content =
{
width = 320,
height = 480,
scale = &quot;zoomEven&quot;,
},
}</pre>
<p>In main.lua, I&#8217;ve made a few more changes. Each image object is now 320 pixels wide and 480 pixels tall. This is so each background fills the entire screen. Then, I set the starting point for bg1 on the screen, bg2 480 pixels below bg1, and bg3 480 pixels below bg2. This is more of a primer to our scrolling background effect. Finally, I changed the if-then statements to listen for the y property of the backgrounds. When the background gets to 0, I move them off screen so the backgrounds never stop scrolling.</p>
<p>main.lua</p>
<pre class="wp-code-highlight prettyprint linenums:1">--Hide status bar from the beginning
display.setStatusBar( display.HiddenStatusBar )

-- Set Variables
_W = display.contentWidth; -- Get the width of the screen
_H = display.contentHeight; -- Get the height of the screen
scrollSpeed = 2; -- Set Scroll Speed of background

-- Add First Background
local bg1 = display.newImageRect(&quot;images/bg1.png&quot;, 320, 480)
bg1:setReferencePoint(display.CenterLeftReferencePoint)
bg1.x = 0; bg1.y = _H/2;

-- Add Second Background
local bg2 = display.newImageRect(&quot;images/bg1.png&quot;, 320, 480)
bg2:setReferencePoint(display.CenterLeftReferencePoint)
bg2.x = 0; bg2.y = bg1.y+480;

-- Add Third Background
local bg3 = display.newImageRect(&quot;images/bg1.png&quot;, 320, 480)
bg3:setReferencePoint(display.CenterLeftReferencePoint)
bg3.x = 0; bg3.y = bg2.y+480;

local function move(event)

-- move backgrounds to the left by scrollSpeed, default is 8
bg1.y = bg1.y + scrollSpeed
bg2.y = bg2.y + scrollSpeed
bg3.y = bg3.y + scrollSpeed

-- Set up listeners so when backgrounds hits a certain point off the screen,
-- move the background to the right off screen
if (bg1.y + bg1.contentWidth) &amp;gt; 1040 then
bg1:translate( 0, -960 )
end
if (bg2.y + bg2.contentWidth) &amp;gt; 1040 then
bg2:translate( 0, -960 )
end
if (bg3.y + bg3.contentWidth) &amp;gt; 1040 then
bg3:translate( 0, -960 )
end
end

-- Create a runtime event to move backgrounds
Runtime:addEventListener( &quot;enterFrame&quot;, move )</pre>
<p>The only thing you&#8217;ll need to make this work is a background graphic that&#8217;s 320 by 480.</p>
<p>Again, this post was to just show the changes from the horizontal scrolling background to the vertical scrolling background. If you would like to see more Corona SDK tutorials, please leave a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-down/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create a Scrolling Background &#8211; Going Up!</title>
		<link>http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-up/</link>
		<comments>http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-up/#comments</comments>
		<pubDate>Fri, 10 May 2013 00:37:03 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Corona SDK Tutorials]]></category>
		<category><![CDATA[Game Development]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2232</guid>
		<description><![CDATA[I was recently asked to expand on my scrolling background tutorial to change the direction from left and right to down to up. Well, here it is! In today&#8217;s post, we are going to learn how to make a vertically scrolling background with Corona SDK. The background [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://thatssopanda.com/wp-content/uploads/2013/05/bg1.png" rel="wp-prettyPhoto[2232]"><img class="size-medium wp-image-2233 alignleft" style="margin: 10px;" alt="bg1" src="http://thatssopanda.com/wp-content/uploads/2013/05/bg1-200x300.png" width="134" height="201" /></a></p>
<p>I was recently asked to expand on my scrolling background tutorial to change the direction from left and right to down to up. Well, here it is!</p>
<p>In today&#8217;s post, we are going to learn how to make a vertically scrolling background with Corona SDK. The background will scroll from the bottom of the screen to the top of the screen. The code to make this change isn&#8217;t much, so I&#8217;ll just point out the differences from my other post at <a href="http://thatssopanda.com/corona-sdk-tutorials/creating-a-horizontal-scrolling-background-in-corona-sdk/">Creating a Horizontal Scrolling Background in Corona SDK</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Since we have a vertically scrolling background, I&#8217;ve changed the default and supported orientation to portrait instead of landscape.</p>
<p>Build.settings</p>
<pre class="wp-code-highlight prettyprint linenums:1">settings =
{
orientation =
{
default = &quot;portrait&quot;,

supported =
{
&quot;portrait&quot;,
},

},
}</pre>
<p>Everything in config.lua stays the same.</p>
<p>Config.lua</p>
<pre class="wp-code-highlight prettyprint linenums:1">-- config.lua
application =
{
content =
{
width = 320,
height = 480,
scale = &quot;zoomEven&quot;,
},
}</pre>
<p>In main.lua, I&#8217;ve made a few more changes. Each image object is now 320 pixels wide and 480 pixels tall. This is so each background fills the entire screen. Then, I set the starting point for bg1 on the screen, bg2 480 pixels below bg1, and bg3 480 pixels below bg2. This is more of a primer to our scrolling background effect. Finally, I changed the if-then statements to listen for the y property of the backgrounds. When the background gets to 0, I move them off screen so the backgrounds never stop scrolling.</p>
<p>main.lua</p>
<pre class="wp-code-highlight prettyprint linenums:1">--Hide status bar from the beginning
display.setStatusBar( display.HiddenStatusBar )

-- Set Variables
_W = display.contentWidth; -- Get the width of the screen
_H = display.contentHeight; -- Get the height of the screen
scrollSpeed = 2; -- Set Scroll Speed of background

-- Add First Background
local bg1 = display.newImageRect(&quot;images/bg1.png&quot;, 320, 480)
bg1:setReferencePoint(display.CenterLeftReferencePoint)
bg1.x = 0; bg1.y = _H/2;

-- Add Second Background
local bg2 = display.newImageRect(&quot;images/bg1.png&quot;, 320, 480)
bg2:setReferencePoint(display.CenterLeftReferencePoint)
bg2.x = 0; bg2.y = bg1.y+480;

-- Add Third Background
local bg3 = display.newImageRect(&quot;images/bg1.png&quot;, 320, 480)
bg3:setReferencePoint(display.CenterLeftReferencePoint)
bg3.x = 0; bg3.y = bg2.y+480;

local function move(event)

-- move backgrounds to the left by scrollSpeed, default is 8
bg1.y = bg1.y - scrollSpeed
bg2.y = bg2.y - scrollSpeed
bg3.y = bg3.y - scrollSpeed

-- Set up listeners so when backgrounds hits a certain point off the screen,
-- move the background to the right off screen
if (bg1.y + bg1.contentWidth) &lt; 0 then
bg1:translate( 0, 480*3 )
end
if (bg2.y + bg2.contentWidth) &lt; 0 then
bg2:translate( 0, 480*3 )
end
if (bg3.y + bg3.contentWidth) &lt; 0 then
bg3:translate( 0, 480*3 )
end
end

-- Create a runtime event to move backgrounds
Runtime:addEventListener( &quot;enterFrame&quot;, move )</pre>
<p>The only thing you&#8217;ll need to make this work is a background graphic that&#8217;s 320 by 480.</p>
<p>Again, this post was to just show the changes from the horizontal scrolling background to the vertical scrolling background. If you would like to see more tutorials, please leave a comment below!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/corona-sdk-tutorials/create-a-scrolling-background-going-up/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to create a blinking effect with Corona SDK</title>
		<link>http://thatssopanda.com/corona-sdk-tutorials/how-to-create-a-blinking-effect-with-corona-sdk/</link>
		<comments>http://thatssopanda.com/corona-sdk-tutorials/how-to-create-a-blinking-effect-with-corona-sdk/#comments</comments>
		<pubDate>Mon, 01 Apr 2013 10:00:41 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Corona SDK Tutorials]]></category>
		<category><![CDATA[Corona Basics]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2217</guid>
		<description><![CDATA[Today&#8217;s post is a quick one, but I&#8217;ve seen some developers ask how to create a blinking effect with Corona SDK. Creating a blink effect is as simple as modifying the alpha attribute on a display object (text, image or otherwise). Let&#8217;s take a look at the [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://thatssopanda.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-31-at-10.53.15-AM.png" rel="wp-prettyPhoto[2217]"><img class="aligncenter size-full wp-image-2218" alt="Screen Shot 2013-03-31 at 10.53.15 AM" src="http://thatssopanda.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-31-at-10.53.15-AM.png" width="518" height="344" /></a></p>
<p>Today&#8217;s post is a quick one, but I&#8217;ve seen some developers ask how to create a blinking effect with Corona SDK. Creating a blink effect is as simple as modifying the alpha attribute on a display object (text, image or otherwise). Let&#8217;s take a look at the source code on how to make our text blink.</p>
<p>The first step is to hide the display bar and set some global variables.</p>
<pre class="wp-code-highlight prettyprint linenums:1">--Hide status bar from the beginning
display.setStatusBar( display.HiddenStatusBar ) 

-- Set Variables
_W = display.contentWidth; -- Get the width of the screen
_H = display.contentHeight; -- Get the height of the screen</pre>
<p>Next, we will add a text display object to the screen. We will be making this object blink in our example, but you can use an image here as well.</p>
<pre class="wp-code-highlight prettyprint linenums:1">local txt_taptobegin = display.newText(&quot;This is Blinking Text&quot;, 100, 100, &quot;Arial&quot;, 22)
    txt_taptobegin.x = _W/2
    txt_taptobegin.y = _H/2</pre>
<p>Then, we will create the blink function. In this function, we are running a simple if-then-else statement. If the alpha (transparency) of the object is below 1, then set the transition to alpha 1. Otherwise, set the transition to alpha 0.1.</p>
<pre class="wp-code-highlight prettyprint linenums:1">function blink()
    if(txt_taptobegin.alpha &amp;lt; 1) then
        transition.to( txt_taptobegin, {time=490, alpha=1})
    else 
        transition.to( txt_taptobegin, {time=490, alpha=0.1})
    end
end</pre>
<p>After the function, we will create a timer that will be called every 500ms. The key part to making the blink effect work is the timing. In the transition.to, I&#8217;ve set the time to 490ms and the timer has been set to 500ms. The transition.to must be completed before the timer. Otherwise, you setting your app up for some weird effects.</p>
<pre class="wp-code-highlight prettyprint linenums:1">txt_blink = timer.performWithDelay(500, blink, 0)</pre>
<p>And that&#8217;s it to make a display object &#8216;blink&#8217;! Thank you for reading another post by That&#8217;s So Panda!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/corona-sdk-tutorials/how-to-create-a-blinking-effect-with-corona-sdk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Gradients with Corona SDK</title>
		<link>http://thatssopanda.com/corona-sdk-tutorials/using-gradients-with-corona-sdk/</link>
		<comments>http://thatssopanda.com/corona-sdk-tutorials/using-gradients-with-corona-sdk/#comments</comments>
		<pubDate>Mon, 25 Mar 2013 10:00:39 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Corona SDK Tutorials]]></category>
		<category><![CDATA[Corona Basics]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2205</guid>
		<description><![CDATA[One of the lesser known features about Corona SDK may be the ability to use gradients on display objects within your app. With gradients, you can add a certain level of shine or luster to your display objects. You can also set the direction of the gradient [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://thatssopanda.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-21-at-9.17.38-PM.png" rel="wp-prettyPhoto[2205]"><img class="aligncenter size-full wp-image-2206" alt="Screen Shot 2013-03-21 at 9.17.38 PM" src="http://thatssopanda.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-21-at-9.17.38-PM.png" width="498" height="335" /></a></p>
<p>One of the lesser known features about Corona SDK may be the ability to use gradients on display objects within your app. With gradients, you can add a certain level of shine or luster to your display objects. You can also set the direction of the gradient with Corona SDK. Currently, the gradient feature is only available to the circle or rectangle display objects that are created with newRect() or newCircle().</p>
<p>Let&#8217;s take a look at how to use gradients by creating 3 rectangles that will change the gradient color and direction every half a second.</p>
<p>Our first step is to hide the status bar and set up two global variables that will capture the content width and content height.</p>
<pre class="wp-code-highlight prettyprint linenums:1">--Hide status bar from the beginning
display.setStatusBar( display.HiddenStatusBar ) 

-- Set Variables
_W = display.contentWidth; -- Get the width of the screen
_H = display.contentHeight; -- Get the height of the screen</pre>
<p>Next, we are going to create two tables that will hold the squares and the available directions of the gradients.</p>
<pre class="wp-code-highlight prettyprint linenums:1">squares = {}
direction = {&quot;up&quot;,&quot;left&quot;,&quot;right&quot;,&quot;down&quot;}</pre>
<p>Then, we are going to add the squares to the screen by using Corona&#8217;s display.newRect().</p>
<pre class="wp-code-highlight prettyprint linenums:1">squares[1] = display.newRect( 0, 0, 100, 100 )
squares[1].x = _W * .8
squares[1].y = _H/2

squares[2] = display.newRect( 0, 0, 100, 100 )
squares[2].x = _W/2
squares[2].y = _H/2

squares[3] = display.newRect( 0, 0, 100, 100 )
squares[3].x = _W * .2
squares[3].y = _H/2</pre>
<p>Once we have set up our squares, we will then set up a function that will change the gradient color and direction of our squares. We accomplish this by create a function named gradient and we&#8217;ll make it accept 4 arguments. The four arguments are red, green, blue, and the direction of the gradient. With the arguments, we create a new gradient and return the gradient value. The returned value will be the new gradient used in our shape.</p>
<pre class="wp-code-highlight prettyprint linenums:1">local function gradient( r, g, b, dir )
    local color = graphics.newGradient(
        { r, g, b },
        { r * math.random(0,1), g * math.random(0,1), b * math.random(0,1) },
        dir )
    return color
end</pre>
<p>Our last function will be to actually change the gradient. This function will cycle through the squares table and create a random value for r, g, b, and dir (red, green, blue, and direction). These values are then passed to function gradient to change the color of the square.</p>
<pre class="wp-code-highlight prettyprint linenums:1">local function changeGradient()    
    for i=1,#squares do
        r = math.random(1,255)
        g = math.random(1,255)
        b = math.random(1,255)
        dir = math.random(1,4)

        squares[i]:setFillColor( gradient( r, g, b, direction[dir]))
    end
end</pre>
<p>Finally, we will set up a timer that will call the function changeGradient every half a second.</p>
<pre class="wp-code-highlight prettyprint linenums:1">timer.performWithDelay(500, changeGradient, 0)</pre>
<p>And that&#8217;s it! With less than 50 lines of code, you have created 3 squares that change color with a gradient. If you have questions or comments, please leave them below! Thanks for reading at <a href="http://thatssopanda.com/">ThatsSoPanda.com</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/corona-sdk-tutorials/using-gradients-with-corona-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tips with Dropbox</title>
		<link>http://thatssopanda.com/blog/tips-with-dropbox/</link>
		<comments>http://thatssopanda.com/blog/tips-with-dropbox/#comments</comments>
		<pubDate>Mon, 18 Mar 2013 10:00:26 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2199</guid>
		<description><![CDATA[Dropbox is an great product for file sharing and making backups of your game builds. Every once in awhile, you may come across an issue with Dropbox that could cause an infinite sync or other issues with getting your files from or to Dropbox. To avoid this, [...]]]></description>
				<content:encoded><![CDATA[<p>Dropbox is an great product for file sharing and making backups of your game builds. Every once in awhile, you may come across an issue with Dropbox that could cause an infinite sync or other issues with getting your files from or to Dropbox. To avoid this, you can use Dropbox&#8217;s not-so-well known feature of bad files check. The bad files check will let you know what files could not be uploaded due to an invalid name or other issues. Here&#8217;s the link: <a href="https://www.dropbox.com/bad_files_check">https://www.dropbox.com/bad_files_check</a></p>
<p>If you don&#8217;t already use Dropbox or another file sharing service, I strongly suggest that you do. Dropbox has a built in file version feature that can help you control your game builds. Dropbox also backs up your files which is never a bad thing!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/blog/tips-with-dropbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Clock with Corona SDK</title>
		<link>http://thatssopanda.com/corona-sdk-tutorials/creating-a-clock-with-corona-sdk/</link>
		<comments>http://thatssopanda.com/corona-sdk-tutorials/creating-a-clock-with-corona-sdk/#comments</comments>
		<pubDate>Mon, 11 Mar 2013 10:00:00 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Corona SDK Tutorials]]></category>
		<category><![CDATA[Corona Basics]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2185</guid>
		<description><![CDATA[Late one night, instead of sleeping, I created a clock with Corona SDK. Creating a clock was a easier than I initially thought and I felt I should share the code on www.thatssopanda.com. So, here&#8217;s how I created a working clock with Corona SDK. First, I created [...]]]></description>
				<content:encoded><![CDATA[<p><img class="size-full wp-image-2196 aligncenter" alt="Screen Shot 2013-03-07 at 6.49.34 PM" src="http://thatssopanda.com/wp-content/uploads/2013/03/Screen-Shot-2013-03-07-at-6.49.34-PM.png" width="340" height="231" /></p>
<p>Late one night, instead of sleeping, I created a clock with Corona SDK. Creating a clock was a easier than I initially thought and I felt I should share the code on <a href="www.thatssopanda.com">www.thatssopanda.com</a>. So, here&#8217;s how I created a working clock with Corona SDK.</p>
<p>First, I created a new file called main.lua and added the following code. This allows me to hide the status bar and get the width and height of my screen.</p>
<pre class="wp-code-highlight prettyprint linenums:1">--Hide status bar from the beginning
display.setStatusBar( display.HiddenStatusBar ) 

-- Set Variables
_W = display.contentWidth; -- Get the width of the screen
_H = display.contentHeight; -- Get the height of the screen</pre>
<p>Next, we&#8217;ll add some display objects to our screen so we can see the clock outline, the hour hand, the minute hand, and the second hand. I used Corona&#8217;s built-in functions to create one circle and three lines. Each line has a different color and length so we can keep them separated.</p>
<pre class="wp-code-highlight prettyprint linenums:1">clockBorder = display.newCircle(_W/2,_H/2,125)
clockBorder:setFillColor(0,0,0)
clockBorder.strokeWidth = 5
clockBorder:setStrokeColor(255,255,255)

hourHand = display.newLine(_W/2,_H/2,_W/2,80)
hourHand.width = 5
hourHand:setColor(0,255,0)

minuteHand = display.newLine(_W/2,_H/2,_W/2,47)
minuteHand.width = 3
minuteHand:setColor(0,50,255)

secondHand = display.newLine(_W/2,_H/2,_W/2,37)
secondHand.width = 2
secondHand:setColor(255,0,0)</pre>
<p>After the display objects, we create a function that will update our clock based on the current time. We can accomplish this by using os.date() and storing this as the current time. Based on the current time, we will rotate each hand to the appropriate location.</p>
<pre class="wp-code-highlight prettyprint linenums:1">local function updateCLock(e)  
    local currentTime = os.date(&quot;*t&quot;)
    secondHand.rotation = currentTime.sec * 6  
    minuteHand.rotation = currentTime.min * 6  
    hourHand.rotation = currentTime.hour * 30 + (currentTime.min * 0.5)      
end</pre>
<p>Then, we call the function so each clock hand shows in the right location.</p>
<pre class="wp-code-highlight prettyprint linenums:1">updateCLock()</pre>
<p>Finally, we call the function using a timer that goes off every second. By using the timer, we can make sure that the clock is being updated forever.</p>
<pre class="wp-code-highlight prettyprint linenums:1">timer.performWithDelay(1000, updateCLock, 0)</pre>
<p>That&#8217;s it! Corona SDK allows me to rapidly produce prototypes and although a clock by itself may not be very useful, you can clocks inside your game to provide a timer visual or in an app that needs timed events. I&#8217;ve provided the full source code to the clock below. The code is broken up into main.lua, config.lua, and build.settings.</p>
<h3>Main.lua</h3>
<pre class="wp-code-highlight prettyprint linenums:1">--Hide status bar from the beginning
display.setStatusBar( display.HiddenStatusBar ) 

-- Set Variables
_W = display.contentWidth; -- Get the width of the screen
_H = display.contentHeight; -- Get the height of the screen

clockBorder = display.newCircle(_W/2,_H/2,125)
clockBorder:setFillColor(0,0,0)
clockBorder.strokeWidth = 5
clockBorder:setStrokeColor(255,255,255)

hourHand = display.newLine(_W/2,_H/2,_W/2,80)
hourHand.width = 5
hourHand:setColor(0,255,0)

minuteHand = display.newLine(_W/2,_H/2,_W/2,47)
minuteHand.width = 3
minuteHand:setColor(0,50,255)

secondHand = display.newLine(_W/2,_H/2,_W/2,37)
secondHand.width = 2
secondHand:setColor(255,0,0)

local function updateCLock(e)  
    local currentTime = os.date(&quot;*t&quot;)
    secondHand.rotation = currentTime.sec * 6  
    minuteHand.rotation = currentTime.min * 6  
    hourHand.rotation = currentTime.hour * 30 + (currentTime.min * 0.5)      
end 

updateCLock()
timer.performWithDelay(1000, updateCLock, 0)</pre>
<h3>Config.lua</h3>
<pre class="wp-code-highlight prettyprint linenums:1">-- config.lua
application =
{
	content =
	{
		width = 320,
		height = 480,
		scale = &quot;zoomEven&quot;,
	},
}</pre>
<h3>Build.settings</h3>
<pre class="wp-code-highlight prettyprint linenums:1">settings = 
{
	orientation = 
	{
		default = &quot;landscape&quot;,

		supported = 
		{
		&quot;landscape&quot;,
		},

	},
}</pre>
<p>If you have any more questions or comments, please let me know through the comments below. Thank you for reading another post from That&#8217;s So Panda!</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/corona-sdk-tutorials/creating-a-clock-with-corona-sdk/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Using Shuffle with Lua</title>
		<link>http://thatssopanda.com/corona-sdk-tutorials/using-shuffle-with-lua/</link>
		<comments>http://thatssopanda.com/corona-sdk-tutorials/using-shuffle-with-lua/#comments</comments>
		<pubDate>Mon, 04 Mar 2013 23:43:42 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Corona SDK Tutorials]]></category>
		<category><![CDATA[Using Lua]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2169</guid>
		<description><![CDATA[Sometimes you need to be able to randomize a table in your Corona SDK app (or any other platform that uses Lua). So, here&#8217;s how you do it. local function shuffle(t) local n = #t while n &#38;gt; 2 do local k = math.random(n) t[n], t[k] = [...]]]></description>
				<content:encoded><![CDATA[<p>Sometimes you need to be able to randomize a table in your Corona SDK app (or any other platform that uses Lua). So, here&#8217;s how you do it.</p>
<pre class="wp-code-highlight prettyprint linenums:1">local function shuffle(t)
  local n = #t
  while n &amp;gt; 2 do
    local k = math.random(n)
    t[n], t[k] = t[k], t[n]
    n = n - 1
 end
 return t
end</pre>
<p>This function accepts one argument, a table, and then proceeds to randomize the elements of the table. It randomizes the elements of the table by making use of the math.random tool.</p>
<p>Now, I can&#8217;t claim credit for creating this shuffle function, but I wanted to post it for other developers use. If you know who the original developer is who created this function, please let me know and I will give due credit.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/corona-sdk-tutorials/using-shuffle-with-lua/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Talon Property Inspections</title>
		<link>http://thatssopanda.com/other-projects/talon-property-inspections/</link>
		<comments>http://thatssopanda.com/other-projects/talon-property-inspections/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 15:55:46 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Other Projects]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2124</guid>
		<description><![CDATA[Approached with the need for an online presence, we developed a website based on responsive design for Talon Property Inspections. Whether a potential customer was viewing their website on a desktop computer or their phone, customers will be able to learn what Talon Property Inspections has to [...]]]></description>
				<content:encoded><![CDATA[<p>Approached with the need for an online presence, we developed a website based on responsive design for Talon Property Inspections. Whether a potential customer was viewing their website on a desktop computer or their phone, customers will be able to learn what Talon Property Inspections has to offer and how to contact them.</p>
<p>Visit <a href="http://www.talonpropertyinspections.com/">www.talonpropertyinspections.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/other-projects/talon-property-inspections/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Janet Sells Indy</title>
		<link>http://thatssopanda.com/other-projects/janet-sells-indy/</link>
		<comments>http://thatssopanda.com/other-projects/janet-sells-indy/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 15:34:15 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Other Projects]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2145</guid>
		<description><![CDATA[JanetSellsIndy.com is a real estate website created on a WordPress platform for a real estate agent in the Indianapolis area. This website allows visitors to search all the homes in the Central Indiana area and get local information about select cities.]]></description>
				<content:encoded><![CDATA[<p>JanetSellsIndy.com is a real estate website created on a WordPress platform for a real estate agent in the Indianapolis area. This website allows visitors to search all the homes in the Central Indiana area and get local information about select cities.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/other-projects/janet-sells-indy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Tucker</title>
		<link>http://thatssopanda.com/other-projects/why-tucker/</link>
		<comments>http://thatssopanda.com/other-projects/why-tucker/#comments</comments>
		<pubDate>Sat, 19 Jan 2013 15:06:56 +0000</pubDate>
		<dc:creator>spoggles</dc:creator>
				<category><![CDATA[Other Projects]]></category>

		<guid isPermaLink="false">http://thatssopanda.com/?p=2138</guid>
		<description><![CDATA[Why Tucker was developed for a real estate company that required a website where potential real estate agents could learn more about transitioning to their company. This website was designed and developed as a single landing page to help capture the attention of potential recruits.]]></description>
				<content:encoded><![CDATA[<p>Why Tucker was developed for a real estate company that required a website where potential real estate agents could learn more about transitioning to their company. This website was designed and developed as a single landing page to help capture the attention of potential recruits.</p>
]]></content:encoded>
			<wfw:commentRss>http://thatssopanda.com/other-projects/why-tucker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
