iPhone Development




                                   with CORONA SDK
Friday, April 16, 2010
April 13, 2010
                           Tuesday 4:00 pm - 5:20 pm
                         Evan Kirchhoff & Scott Janouse...
Intro



Friday, April 16, 2010
Agenda
                         SCOTT JANOUSEK (Hooken Mobile)
                            Overview of Corona SDK, iPhone/...
Evan Kirchhoff

                         Senior Software Engineer, Ansca Mobile
                         Legacy Flash Devel...
Scott Janousek
                         Boston, MA, USA


                         10+ year Flash Veteran
                ...
Scott’s Types of Projects *




  * Not-Corona, but no reason why future ports can’t happen. :)

Friday, April 16, 2010
Co-authored Flash Books
                         Foundation Flash for Mobile Devices
                         www.flashmobi...
First impressions to Corona SDK

                         “I can’t believe how short a time it took to get up to
         ...
Prototype (using Corona)




Friday, April 16, 2010
My Contact Info
                         SCOTT JANOUSEK
                         @scottjanousek
                         s...
Getting Started



Friday, April 16, 2010
What is Corona?
                         An SDK that allows developers to
                         write mobile and device...
Build Once, Deploy to Many
                              Corona SDK on a Mac




                         Android      App...
Apps Corona is good at:

                           2-D Games
                           Graphical-oriented Utilities
    ...
Content we’ll talk about today




                          Prototype, avoid asteroids type game   Game with physics engi...
Where to download the SDK
                         `




Friday, April 16, 2010
Registration
                                         $20 off
                                                 Corona
     ...
Corona installation folder




Friday, April 16, 2010
What’s in the Corona SDK




Friday, April 16, 2010
SDK Documentation

                                   `




Friday, April 16, 2010
Sample Code




Friday, April 16, 2010
Opening Corona projects




Friday, April 16, 2010
Corona Development Environment

                         Projects are kept separate folders
                         Asset...
SIMULATOR




Friday, April 16, 2010
SIMULATOR - iPhone




Friday, April 16, 2010
SIMULATOR - iPad




Friday, April 16, 2010
Debugger




Friday, April 16, 2010
Corona Work ow
                         Design app in any Graphics Editor
                         Develop (lua) code in a...
Lua Basics



Friday, April 16, 2010
First experiences with Lua

                            Whoa, what language?
                            Wow, Documentatio...
Hello World with Corona




Friday, April 16, 2010
Lua Programming
                         Variables
                         Tables
                         Functions
    ...
Variables in Lua




Friday, April 16, 2010
Tables in Lua




Friday, April 16, 2010
Code Comments in Lua




Friday, April 16, 2010
Buttons in Lua




Friday, April 16, 2010
The Lua Language “Bible”




Friday, April 16, 2010
Lua Books




Friday, April 16, 2010
Code Editor to use

                         BBEdit
                         XCode
                         and anything e...
Game Prototype
                          Walkthrough


Friday, April 16, 2010
Prototype (using Corona)




Friday, April 16, 2010
My First (Simple) Game

                           Simple 2D game
                           Only few hours into this proj...
Designing the Game




                               Adobe          Adobe
                             Fireworks      Pho...
Developing the Game




Friday, April 16, 2010
Populating the StarField




Friday, April 16, 2010
Animating Player/Asteriods




Friday, April 16, 2010
Game Assets




Friday, April 16, 2010
Main Game Loop




Friday, April 16, 2010
Moving the Ship




Friday, April 16, 2010
Collision Detection




Friday, April 16, 2010
Lua Game Framework


                          ui.lua - for buttons & labels
                          sprite.lua - for an...
Testing the Game




Friday, April 16, 2010
File->Relaunch

                          You will use
                          Command-R
                             A ...
Debugging the Game




Friday, April 16, 2010
Deploying the Game

                         Game still under development
                         Not yet on the Apple Ap...
Lessons Learned along way

                         Keep it simple
                         Experiment with Sample Lua Cod...
Things I like about Corona ...
                         Toolset is easy to use
                         Lua is a simple la...
Corona 2D Physics Engine



Friday, April 16, 2010
Corona 2D Physics Engine
                            Integrates Box2D C++ libraries
                            (as in Rol...
Corona 2D Physics Engine

                            Rigid-body physics model
                            Continuous coll...
Invisible Collision Geometry




Friday, April 16, 2010
Box2D: the C++ API




                                        (...)
Friday, April 16, 2010
Box2D: the C++ API
                         (...)




Friday, April 16, 2010
-0.54   1.42   2.80
                              -0.56   1.41   2.81
                              -0.58   1.39   2.83
  ...
What else does it need?
                             // (OpenGL-ES setup code removed for clarity)

                      ...
The equivalent Corona demo
       local physics = require("physics")

       physics.start()


       local grass = displa...
What does this example do?




Friday, April 16, 2010
Creating a Physics Game in
                                Five Minutes




Friday, April 16, 2010
1. Setup




Friday, April 16, 2010
2. Background graphics




Friday, April 16, 2010
3. Ground (physical)




Friday, April 16, 2010
4. Ramp (physical)
                         (You’d also want to add a handful of sprites for the castle, etc.)




Friday,...
4. Ramp (physical)




Friday, April 16, 2010
5. Place eggs (animated)




Friday, April 16, 2010
6. Score display




Friday, April 16, 2010
7. Boulder (and Camera)




Friday, April 16, 2010
8. Collision detection and scoring




Friday, April 16, 2010
9. Play game!




Friday, April 16, 2010
Wrap Up



Friday, April 16, 2010
Urls

                         developer.anscamobile.com
                         lua.org
                         corona....
Thanks for listening.



Friday, April 16, 2010
What are your questions?



Friday, April 16, 2010
April 13, 2010
                         Tuesday 4:00 pm - 5:20 pm
                               Evan & Scott


Friday, Ap...
Upcoming SlideShare
Loading in...5
×

iPhone Development with Corona SDK

8,738

Published on

360|iDev Presentation
Apri

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
8,738
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
176
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

iPhone Development with Corona SDK

  1. 1. iPhone Development with CORONA SDK Friday, April 16, 2010
  2. 2. April 13, 2010 Tuesday 4:00 pm - 5:20 pm Evan Kirchhoff & Scott Janousek Friday, April 16, 2010
  3. 3. Intro Friday, April 16, 2010
  4. 4. Agenda SCOTT JANOUSEK (Hooken Mobile) Overview of Corona SDK, iPhone/iPad speci cs, nuts & bolts EVAN KIRCHHOFF (Ansca Mobile) Game Dev & the new Corona Physics Engine Q&A The part almost everyone likes ... Friday, April 16, 2010
  5. 5. Evan Kirchhoff Senior Software Engineer, Ansca Mobile Legacy Flash Developer (10+ years) Loves Physics Engines Friday, April 16, 2010
  6. 6. Scott Janousek Boston, MA, USA 10+ year Flash Veteran 4 years Mobile & Devices Dev Mobile & Device Platforms iPhone/iPad, Android, Symbian, Maemo, & many more I like the a lot of the ideas behind Corona Friday, April 16, 2010
  7. 7. Scott’s Types of Projects * * Not-Corona, but no reason why future ports can’t happen. :) Friday, April 16, 2010
  8. 8. Co-authored Flash Books Foundation Flash for Mobile Devices www.flashmobilebook.com AdvancED Flash on Devices: Mobile Development with Flash Lite and Flash 10 advancED.flashmobilebook.com Friday, April 16, 2010
  9. 9. First impressions to Corona SDK “I can’t believe how short a time it took to get up to speed developing mobile apps with Corona. It’s one of the better emerging mobile development kits I’ve used recently ... pretty cool stuff.” - Scott Janousek Friday, April 16, 2010
  10. 10. Prototype (using Corona) Friday, April 16, 2010
  11. 11. My Contact Info SCOTT JANOUSEK @scottjanousek scott@scottjanousek.com corona.scottjanousek.com www.hookenmobile.com Friday, April 16, 2010
  12. 12. Getting Started Friday, April 16, 2010
  13. 13. What is Corona? An SDK that allows developers to write mobile and device apps for various platforms, quickly, and easily. Corona is made by Ansca Mobile: www.anscamobile.com Friday, April 16, 2010
  14. 14. Build Once, Deploy to Many Corona SDK on a Mac Android Apple (iPhone/iPad) Friday, April 16, 2010
  15. 15. Apps Corona is good at: 2-D Games Graphical-oriented Utilities Adware & Branded Apps Rapid Prototyping Friday, April 16, 2010
  16. 16. Content we’ll talk about today Prototype, avoid asteroids type game Game with physics engine Friday, April 16, 2010
  17. 17. Where to download the SDK ` Friday, April 16, 2010
  18. 18. Registration $20 off Corona registra tion COUPO N CODE 360ide v2010 Friday, April 16, 2010
  19. 19. Corona installation folder Friday, April 16, 2010
  20. 20. What’s in the Corona SDK Friday, April 16, 2010
  21. 21. SDK Documentation ` Friday, April 16, 2010
  22. 22. Sample Code Friday, April 16, 2010
  23. 23. Opening Corona projects Friday, April 16, 2010
  24. 24. Corona Development Environment Projects are kept separate folders Assets are compiled into app App Code starts in le “main.lua” Code Editors : Text Wrangler, BBEdit, Coda, XCode ... Friday, April 16, 2010
  25. 25. SIMULATOR Friday, April 16, 2010
  26. 26. SIMULATOR - iPhone Friday, April 16, 2010
  27. 27. SIMULATOR - iPad Friday, April 16, 2010
  28. 28. Debugger Friday, April 16, 2010
  29. 29. Corona Work ow Design app in any Graphics Editor Develop (lua) code in any text editor Load code into Corona Simulator Test your app with Sim Compile App via XCode Deploy Friday, April 16, 2010
  30. 30. Lua Basics Friday, April 16, 2010
  31. 31. First experiences with Lua Whoa, what language? Wow, Documentation? Awesome! :) LOTS of sample code? Fantastic! Also, many “syntax books” on lua Friday, April 16, 2010
  32. 32. Hello World with Corona Friday, April 16, 2010
  33. 33. Lua Programming Variables Tables Functions Events ... more Friday, April 16, 2010
  34. 34. Variables in Lua Friday, April 16, 2010
  35. 35. Tables in Lua Friday, April 16, 2010
  36. 36. Code Comments in Lua Friday, April 16, 2010
  37. 37. Buttons in Lua Friday, April 16, 2010
  38. 38. The Lua Language “Bible” Friday, April 16, 2010
  39. 39. Lua Books Friday, April 16, 2010
  40. 40. Code Editor to use BBEdit XCode and anything else ... Friday, April 16, 2010
  41. 41. Game Prototype Walkthrough Friday, April 16, 2010
  42. 42. Prototype (using Corona) Friday, April 16, 2010
  43. 43. My First (Simple) Game Simple 2D game Only few hours into this project I am not done yet (prototype) I like the immediate results! Friday, April 16, 2010
  44. 44. Designing the Game Adobe Adobe Fireworks Photoshop (Prototyping) (Production) Friday, April 16, 2010
  45. 45. Developing the Game Friday, April 16, 2010
  46. 46. Populating the StarField Friday, April 16, 2010
  47. 47. Animating Player/Asteriods Friday, April 16, 2010
  48. 48. Game Assets Friday, April 16, 2010
  49. 49. Main Game Loop Friday, April 16, 2010
  50. 50. Moving the Ship Friday, April 16, 2010
  51. 51. Collision Detection Friday, April 16, 2010
  52. 52. Lua Game Framework ui.lua - for buttons & labels sprite.lua - for animations Friday, April 16, 2010
  53. 53. Testing the Game Friday, April 16, 2010
  54. 54. File->Relaunch You will use Command-R A LOT with Corona Friday, April 16, 2010
  55. 55. Debugging the Game Friday, April 16, 2010
  56. 56. Deploying the Game Game still under development Not yet on the Apple App Store Excited about other Platforms (e.g. Android) with Corona Friday, April 16, 2010
  57. 57. Lessons Learned along way Keep it simple Experiment with Sample Lua Code Visit Ansca Mobile Forum Developer Read Lua Books & Corona Docs Friday, April 16, 2010
  58. 58. Things I like about Corona ... Toolset is easy to use Lua is a simple language to learn Multiple target devices API keeps expanding Physics and other Frameworks TBD The closeknit support Friday, April 16, 2010
  59. 59. Corona 2D Physics Engine Friday, April 16, 2010
  60. 60. Corona 2D Physics Engine Integrates Box2D C++ libraries (as in Rolando & Crayon Physics) ...but with a much simpler API Not yet in beta! Friday, April 16, 2010
  61. 61. Corona 2D Physics Engine Rigid-body physics model Continuous collision detection Contact, friction and restitution Joints, motors, pulleys, ragdoll, etc. Friday, April 16, 2010
  62. 62. Invisible Collision Geometry Friday, April 16, 2010
  63. 63. Box2D: the C++ API (...) Friday, April 16, 2010
  64. 64. Box2D: the C++ API (...) Friday, April 16, 2010
  65. 65. -0.54 1.42 2.80 -0.56 1.41 2.81 -0.58 1.39 2.83 -0.60 1.36 2.84 -0.62 1.34 2.86 -0.64 1.31 2.87 What does this example do? -0.66 1.28 2.89 -0.68 1.25 2.90 -0.70 1.21 2.92 -0.72 1.17 2.93 -0.75 1.16 2.97 -0.77 1.14 3.00 -0.80 1.13 3.04 -0.83 1.11 3.07 (Not that much, yet) -0.86 1.08 3.11 -0.88 1.06 3.15 -0.91 1.03 3.18 (printf is a poor renderer) -0.93 1.04 3.17 -0.94 1.06 3.15 -0.96 1.07 3.13 -0.97 1.08 3.12 -0.99 1.09 3.10 -1.00 1.09 3.09 -1.02 1.09 3.07 -1.03 1.09 3.05 -1.05 1.09 3.04 -1.06 1.09 3.04 -1.07 1.09 3.05 -1.09 1.09 3.06 -1.10 1.09 3.06 -1.11 1.08 3.07 -1.12 1.08 3.07 -1.14 1.06 3.08 -1.15 1.05 3.09 -1.16 1.04 3.10 -1.17 1.03 3.11 -1.19 1.01 3.13 -1.20 1.00 3.14 -1.21 1.00 3.13 -1.22 1.01 3.13 -1.22 1.02 3.12 -1.23 1.02 3.12 -1.24 1.02 3.12 -1.24 1.02 3.12 -1.25 1.02 3.12 -1.25 1.02 3.12 -1.26 1.01 3.13 -1.26 1.00 3.14 -1.27 0.99 3.14 -1.27 1.00 3.14 -1.27 1.00 3.14 Friday, April 16, 2010
  66. 66. What else does it need? // (OpenGL-ES setup code removed for clarity) // Draw "myImage.jpg" NSString *path = [[NSBundle mainBundle] pathForResource:@"myImage" ofType:@"jpg"]; NSData *texData = [[NSData alloc] initWithContentsOfFile:path]; UIImage *image = [[UIImage alloc] initWithData:texData]; if (image == nil) NSLog(@"Do real error checking here"); GLuint width = CGImageGetWidth(image.CGImage); GLuint height = CGImageGetHeight(image.CGImage); CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); void *imageData = malloc( height * width * 4 ); CGContextRef context = CGBitmapContextCreate( imageData, width, height, 8, 4 * width, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big ); CGColorSpaceRelease( colorSpace ); CGRect imageRect = CGRectMake( 0, 0, width, height ); CGContextClearRect( context, imageRect ); CGContextTranslateCTM( context, 0, height - height ); CGContextDrawImage( context, imageRect, image.CGImage ); glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imageData); CGContextRelease(context); free(imageData); [image release]; [texData release]; (etc.) Friday, April 16, 2010
  67. 67. The equivalent Corona demo local physics = require("physics") physics.start() local grass = display.newImage("grass.png") grass.x = 160; grass.y = 460 physics.newSimpleBody( grass, { density=0, friction=0.5, bounce=0.5 } ) local crate = display.newImage("crate.png") crate.x = 175; crate.y = -90; physics.newSimpleBody( crate, { density=1.2, friction=0.5, bounce=0.4 } ) Friday, April 16, 2010
  68. 68. What does this example do? Friday, April 16, 2010
  69. 69. Creating a Physics Game in Five Minutes Friday, April 16, 2010
  70. 70. 1. Setup Friday, April 16, 2010
  71. 71. 2. Background graphics Friday, April 16, 2010
  72. 72. 3. Ground (physical) Friday, April 16, 2010
  73. 73. 4. Ramp (physical) (You’d also want to add a handful of sprites for the castle, etc.) Friday, April 16, 2010
  74. 74. 4. Ramp (physical) Friday, April 16, 2010
  75. 75. 5. Place eggs (animated) Friday, April 16, 2010
  76. 76. 6. Score display Friday, April 16, 2010
  77. 77. 7. Boulder (and Camera) Friday, April 16, 2010
  78. 78. 8. Collision detection and scoring Friday, April 16, 2010
  79. 79. 9. Play game! Friday, April 16, 2010
  80. 80. Wrap Up Friday, April 16, 2010
  81. 81. Urls developer.anscamobile.com lua.org corona.scottjanousek.com Friday, April 16, 2010
  82. 82. Thanks for listening. Friday, April 16, 2010
  83. 83. What are your questions? Friday, April 16, 2010
  84. 84. April 13, 2010 Tuesday 4:00 pm - 5:20 pm Evan & Scott Friday, April 16, 2010
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×