# Baby Steps: Checking Out Corona

After some discussion about what a game is and what makes them fun, we rolled up our sleeves and took a look at our SDK (software development kit), Corona.

Why Corona? Well, mostly, it’s what I know. I’ve used xCode and GameSalad, and I can’t imagine either working very well for our needs. Lua (the language that Corona uses) isn’t super difficult, and, after you get the hang of it, it just seems to make sense. Although I know I’ll end up spending a lot of time proofreading and correcting code, I’m hoping we’ll have one or two naturals to do the bulk of the coding (I’m looking at you, Katie).

For those of you playing along at home, here’s the code from the sample app we made together:

 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 display.setStatusBar( display.HiddenStatusBar ) physics = require("physics") physics.start( true ) physics.setGravity(0, 0) middleX = display.contentWidth/2 middleY = display.contentHeight/2 math.randomseed(os.time()) math.random() --physics.setDrawMode( "hybrid" ) leftWall = display.newRect( 0, 0, 10, 480 ) rightWall = display.newRect( 310, 0, 10, 480 ) topWall = display.newRect( 0, 0, 320, 10 ) bottomWall = display.newRect( 0, 470, 480, 10 ) physics.addBody(leftWall, "static", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) physics.addBody(rightWall, "static", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) physics.addBody(topWall, "static", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) physics.addBody(bottomWall, "static", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false}) background = display.newImage( "bkg_clouds.png" ) function changeColor(event) if event.phase == "began" then randomRed = math.random(0,255) randomBlue = math.random(0,255) randomGreen = math.random(0,255) event.target:setFillColor(randomRed,randomBlue,randomGreen, 255) event.target:applyForce(math.random(-1000,1000),math.random(-1000,1000),0,0) end end function makeBall() ball = display.newCircle( math.random(100,300), math.random(100,400), 30 ) physics.addBody(ball, "dynamic", {density = 1.0, friction = 0.3, bounce = 0.2, isSensor = false, radius=30}) ball:applyForce(math.random(-1000,1000),math.random(-1000,1000),0,0) ball:addEventListener("collision", changeColor) end function makeLotsOfBalls(howMany) for i=1,howMany do makeBall() end end makeLotsOfBalls(10)