官术网_书友最值得收藏!

Time for action – creating a Hello World application in two lines of code

Now that we have the simulator and text editors set up, let's start making our very first Corona program! The first program that we will make is called Hello World. It is a traditional program that many people learn when starting a new programming language.

  1. Open your preferred text editor and type the following lines:
    textObject = display.newText( "Hello World!", 160, 80, native.systemFont, 36 )
    textObject: setFillColor ( 1, 1, 1 )
  2. Next, create a folder on your desktop called Hello World. Save the preceding text as a file named main.lua to the location of your project folder.
  3. Launch Corona. You will be greeted with the Corona SDK screen. Click on Open and navigate to the Hello World folder you just created. You should see your main.lua file in this folder:
    Time for action – creating a Hello World application in two lines of code
  4. On a Mac, click on the Open button. On Windows, select the main.lua file and click on the Open button. You'll see your new program running in the Corona simulator:
    Time for action – creating a Hello World application in two lines of code

Tip

Downloading the example code

You can download the example code files for all Packt Publishing books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

主站蜘蛛池模板: 芜湖市| 望城县| 元谋县| 思南县| 桐城市| 石阡县| 双江| 长宁区| 潜山县| 荣成市| 师宗县| 乐山市| 塘沽区| 上栗县| 咸宁市| 吉林市| 阿拉善右旗| 博爱县| 祥云县| 会同县| 郎溪县| 奉贤区| 庄河市| 岳西县| 洪洞县| 盱眙县| 乐陵市| 建阳市| 抚州市| 慈溪市| 寿阳县| 资中县| 苏州市| 庆阳市| 华坪县| 平阴县| 伊宁市| 嘉定区| 会理县| 如皋市| 丹棱县|