做手遊學英文: 行動遊戲程式設計初階(1) Learning English by ...

62

Transcript of 做手遊學英文: 行動遊戲程式設計初階(1) Learning English by ...

做手遊學英文:行動遊戲程式設計初階 (1)Learning English by Making

Moible Games – Fundamental – Part 1

梁志雄Liang, Chi-Hsiung

中文、英文及程式語言,三語並進提升職場競爭能力。

這是『非典型』教科書或自修工具書,除學習到目前職場上最強手的跨平台遊戲引擎來開發電子書、2D 動畫、行動 APP或遊戲的技能之外,亦可透過中英文並列的教材,有效率及

自然而然的方式,增進職場專業英語的字彙及片語。

About the author 作者介紹

Dr. Chi-Hsiung L iang i s an ass istant Professor of the Department of Multimedia and Game Science at Lunghwa University of Science and Technology in Taiwan, where he has been since 2003. Through the NT$30 million project sponsored by the Minister of Education, he has laid the profound foundation and development of the department in his third term as director.

Dr. Liang received his PhD in computer science at Queen's University Belfast (QUB) in the UK. He has numerous publications in his areas of interest, which include iOS game programming, cross-platform mobile apps , game programming and mobile commerce system. He is recently focusing on developing prospective course series for the integration between mobile gaming and mobile commerce due to the coming of 5G era.

Among the rare scholars and game developers in Taiwan, he has participated in many important game industry events, such as global game developer conferences ( GDC San Francisco, GDC Europe, GDC China and GDC Taipei Summit ) and international game shows ( E3, Tokyo Game Show, Gamescom in Europe and Taipei Game Show ) . The detailed of these events are listed as follows:

• 2003~2004 E3 Game Show (Visitor)

•2005 International Symposium on Game's Science, Education and Applications ( Chair)

• 2005~2008 Tokyo Game Show (Visitor)

• 2009~2013 Tokyo Game Show (Exhibitor)

• 2009, 2010,2012 Gamescom Game Show (2yrs Visitor 1yr. Exhibitor)

• 2006,2012 Taipei International Game Show (Exhibitor)

• 2008~2014 GDC San Francisco.

• 2009~2012 GDC Europe

• 2009, 2010, 2012 GDC China

• 2012, 2013 GDC Taipei Summit

• 2012 Apple Worldwide Developer Conference (WWDC)

• 2012 Cocos2D-X Developer Conference. (China)

• 2013 Global Mobile Game Congress GMGC (China)

• 2013 GDC Next & ADC (L.A.)

• 2014 Tencent Open Mobile Platform & Developer Conf.

• 2015 GDC San Francisco.

• 2016 GDC San Francisco.

• 2017 GDC San Francisco.

• 2018 GDC San Francisco.

• 2019 Taipei International Game Show.(Exhibitor)

• 2019 GDC San Francisco.

•2019 The 1th HH International Esports Conference in Taiwan (Chair)

Dr. Liang also organized a mobile game and app development team in 2009 and has been publishing numerous mobile games and Apps on Apple App store, Google Play store and Windows marketplace since then. The famous masterpiece among all the published products is the Party Magic series , which is the world's first multi-touch and multi-person mobile game that can be played by four people on one iPhone. Having actively participated in the Tokyo Game Show from 2009 to 2013 and the Cologne game show in Germany. He is one of the Taiwanese scholars and game developers who best understands the development of the game industry worldwide, regardless of his experience in science, business, and international cooperation and exchange. He is also the first scholar to appeal to the Taiwan authorities to cultivate at least the Asian-level "Mobile TSMC" to counter the cultural aggression of Taiwan's mobile media and reduce the impact on the industry. And further assist Taiwanese developers with the functions of "Mobile TSMC" to market their R&D mobile applications or games to the world. In addition, he served as a consultant to assist the Taiwan Foreign Trade Association in planning the Taiwan Mobile App Zone of Tokyo Game Show, which was well received a good marketing impact.

At present, he is an expert and scholar of the digital content industry promotion unit in Taiwan, assisting in setting the relevant policies and subsidies, and helping and subsidizing Taiwanese game companies to develop high-quality digital content products and marketing them internationally.

梁志雄博士是台灣龍華科技大學多媒體與遊戲科學系助理教授,自 2003 年以來一直擔任該職位 . 在他擔任該系第三屆主任時,透過由教育部補助的 3000 萬新台幣專案,為該系目前的發展奠定了深厚的基礎。

他在英國貝爾法斯特女皇大學(QUB)獲得計算機科學博士學位。在他感興趣的領域有很多出版物,包括 iOS 遊戲程式設計,跨平台行動應用和遊戲程式設計,行動商務系統等。由於 5G 時代的到來,最近專注於開發行動電競遊戲和行動商務系統之間整合的前瞻性課程系列。在台灣少有的學者和遊戲開發者中,他參加了許多重要的國內外遊戲產業活動,如全球遊戲開發者大會(GDC 舊金山,GDC歐洲,GDC 中國和 GDC 台北峰會)和國際遊戲電玩展(美國 E3 電玩展、日本東京電玩展、歐洲 Gamescom 電玩展和台北國際電玩展等等)。各類詳細活動如下所列:

• 2003~2004 美國 E3 電玩展 ( 參觀者 )

•2005 遊戲科學、教育與應用國際研討會 ( 主辦人 )

• 2005~2008 日本東京電玩展 ( 參觀者 )

• 2009~2013 日本東京電玩展 ( 參展廠商 )

• 2009, 2010,2012 德國科隆電玩展

( 兩年為參觀者 一年為參展廠商 )

• 2006,2012 台北國際電玩展 TGS( 參展廠商 )

• 2008~2014 美國舊金山遊戲開發者大會 (GDC S.F.)

• 2009~2012 德國科隆遊戲開發者大會 (GDC Europe)

• 2009, 2010, 2012 中國上海遊戲開發者大會 (GDC China)

• 2012, 2013 遊戲開發者大會台北峰會 (GDC Taipei Summit)

• 2012 蘋果全球開發者大會 (Apple WWDC)

• 2012 Cocos2D-X 跨平台遊戲引擎開發者大會 ( 北京 )

• 2013 全球行動遊戲大會 GMGC ( 北京 )

• 2013 GDC Next & 行動應用程式開發者大會 ( 美國洛山磯 )

• 2014 騰訊開放行動平台暨開發者大會

• 2015 美國舊金山遊戲開發者大會 (GDC SF)

• 2016. 美國舊金山遊戲開發者大會 (GDC SF)

• 2017 美國舊金山遊戲開發者大會 (GDC SF)

• 2018 美國舊金山遊戲開發者大會 (GDC SF)

• 2019 台北國際電玩展 ( 參展廠商 )(TGS)

• 2019 美國舊金山遊戲開發者大會 (GDC SF)

•2019 第一屆雙華國際電競研討會 ( 主辦人 )

此外,亦於 2009 年織組與培訓行動應用之研發團隊並擔任藝動國際 (Art and Mobile Entertainment) 行動遊戲與應用開發公司的技術長 (CTO),研發成果除了分別於 Apple App Store,Google Play 與 Windows Market Place 上市之外 ( 著名代表作有 Party Magic 系列之行動派對遊戲,這是全世界首款多點觸控與多人同樂的手機遊戲 ) 亦積極參展了 2009~2013 年東京電玩展與德國科隆 Game Show。 因此,無論在學術、產業實務與國際參展經驗上,是最瞭解行動產業發展之臺灣學者與開發者之一。同時,亦是首位學者向政府呼籲及早培植成立至少是亞洲級的『Mobile 台積電』,來抗衡全世界大廠對臺灣行動媒體之文化侵略與減少對產業之衝擊,並進一步協助臺灣開發商,將其研發之行動應用產品推銷到全世界。另外以顧問身分,協助臺灣外貿協會規劃 2012 東京電玩展之 Taiwan Mobile App 專區,受到各界好評與獲得豐碩的行銷效果,目前亦擔任臺灣數位內容產業推動主管單位之專家學者,協助訂定相關政策與補助重點方向,幫助與補助臺灣廠商開發優質之數位內容產品,行銷國際。

Acknowledgments 致謝

I really don't want to forget anyone who has been instrumental and helpful in creating this book, yet I know I can't mention each and every one of you. This is the part of the book that make me a little anxious. If you're not on the list here, that doesn't mean I'm not thankful for your contribution! Give me a pen and I'll scribble your name right here in your copy of the book, and I'll sincerely apologize for not having mentioned you here in the first place. My first thanks go to you, dear reader. Without you, this book wouldn't make any sense.

我真的不想忘記那些在我創作這本書過程方面有助益和有幫助的人,但我知道我不能提及你們每一個人。這是本書讓我有點焦慮的一部分。如果沒有提及你 /妳,那並不意味著我不感謝你們的貢獻!給我一支筆,我會在給你的那本書上,寫下你的名字,我真誠地道歉,因為這裡沒有提到你。親愛的讀者,首先感謝你們。沒有你們,這本書是沒有任何意義。

Now follow the people who helped get this book written, in the order I met them. My first thanks go to Professor Sophie Tsai who put the idea of writing a Chinese-English bilingual book on Corona 2D in my head in the first place. Many thanks to Dr. Julia Hsu and Dr. Dan Jason Calinao, the proofreading editors, who though incredibly busy always found the time and patience to inspect the content of this book and gave me lots of valuable feedback and suggestions.

現在按照我遇到他們幫助寫這本書的人的順序致謝。我首先要感謝 Sophie Tsai 教授,他首先讓我想到了在 Corona 2D 上寫一本中英雙語專業書籍的想法。非也常感謝 Julia Hsu 博士與 Dan Jason Calinao 博士對本書的校對編輯,雖然非常忙碌但總是花時間和耐心來檢查本書的內容,並給了我很多寶貴反饋和建議。

I would like to thank my family for their support – especially my wife for using in-Design software to design a professional book cover and content's layout. Without her effort, this book would not be completed. I also would like to extend my sincere gratitude to students who are in my lab to help me prepare sample codes, chapter figures and writing material for this book.

我要感謝我的家人的支持 – 尤其我的妻子,她使用 In-Design 設計軟體來設計專業的書籍封面和內容的格式。沒有她的努力是無法讓這本書完成。我想對在我實驗

室裡的學生表示衷心的感謝,謝謝他們幫助我為本書準備示範例程式碼,章節的圖表以及製作教材的材料。

Last but not least, thank you to Corona Labs for creating a powerful 2D cross-platform game engine which I actually wanted to write about and also the permission given by Mr.Bektur Manbetov, who is a key member to contributing to Corona labs forums, to translate Corona API library documents, sample codes and relevant articles on the Corona official website for facilitating students or beginners who are not the native English speakers so that thay can learn Corona 2D game and App programming more efficiently and quickly.

最後但同樣重要的是,感謝 Corona Labs 創建了一個強大的 2D 跨平台遊戲引擎而讓我真正想在上面寫些的東西,以及 Bektur Manbetov 先生(Corona 實驗室論壇的主要成員)提供的許可,授權我翻譯 Corona API 庫文檔、Corona 官方網站上的範例程式和相關文章,以方便讓非英語為母語的學生或初學者能更有效與快速地學習 Corona 2D 遊戲和 App 的程式設計。

Preface 前言

Both educational practitioners and researchers in Taiwan have been interested in a question. "Do our college students really learn English in schools?" The question attracts researchers' attentions and consequently produced studies designed to seek for better pedagogies to help students' English learning.

台灣的教育從業者和研究人員都對一個問題感興趣。" 我們的大學生真的在學校學習英語嗎? " 這個問題吸引了研究人員的注意,並因此產生了旨在尋求更好的教學法來幫助學生學習英語的研究。

The primary purposes of this book were to design a textbook both in English and Chinese and teaching video that is kind of an enlightening textbook based on English pronunciation. With the aim of speeding up the reader's learning of English vocabulary, phrases and professional English terms, the relevant vocabulary terms are all in Chinese and English and are distinguished by color, which saves a lot of time in looking up the vocabulary and phrases. Step by step, this book can establish the confidence and ability of learners to read English computer textbooks and documents of all kinds of computer languages.

本書主要的目的是設計紙本為中英文對照而教學影片是以英文發音為主之啟蒙教材,為了加速讀者學習英語字彙、片語與專業英文術語,相關的字彙語術語皆有中英對照並用顏色來區別,省掉許多查閱單字片語的時間,加快學習的速度。淺移默化中建立閱讀資訊英文工具書與函式庫的信心與能力。

Curriculum Features:

Readers/Learners can:

- Use a cross-platform game engine Corona as a tool to make a simple action game:

Learn from scratch and learn by doing.

- Learn professional English in computer programming languages and practice

cross-platform (iOS, Android, Windows Phone, etc. ) mobile game production

skills.

課程特色 :

讀者 / 學習者 能夠 :

- 以「從無到有」與「做中學」之方式利用跨平台遊戲引擎 -Corona,學習如何

製作一個簡單行動遊戲。

- 在實作遊戲過程中同時學習專業電腦程式語言之專業英語與能提升學習意願

之跨 平台 (iOS, Android and Windows Phone ….) 行動遊戲製作技能

Course Objectives:

1. Through this course, you can learn professional English terminologies used in a

cross-platform game engine.

2. Can start to not be excluded from the use of English professional reference books

to learn computer programming language.

3. Can start to use Google to search for English information and join in the English-

based professional forum to look for the solution for the problems generated from

the development of making a program.

4. In line with the government's policy toward south and international exchange

program, as a special course for Southeast Asian or international students to learn

professional knowledge and also learn Chinese at the same time.

課程目標 :

1. 透過此課程能學習到在使用跨平台遊戲引擎時之專業英文術語

2. 能開始不排斥使用學習電腦程式語言之英文專業工具書

3. 能開始透過 Google 搜尋國外以英語為主之專業人士論壇,去獲得解決程式開

發 中所發生問題之解決方案。

4. 配合政府國際交流計畫與南向政策,作為開設東南亞專班或其它國際學生之

專業課程內容,讓外國學生在學習到專業知識的同時,亦能學習到中文。

How to use this book?

For students or beginners who are not related to information technology or engineering backgrounds, teachers can use chapter 1-8 of "Learning English by Making Mobile-Fundamental (Part 1)" as a semester course, while the next semester will use chapters 9-16 of "Learning English by Making Mobile-Fundamental (Part 2)"for teaching. However, for students who are related to IT, they can use two of them for one semester. In addition, "Learning English by Making Mobile-Advanced" must be taught for another semester. However, teachers still need to adjust according to the degree of students and the speed of learning. For self-study learners, they can learn from the short-term in a short period of time. Quickly to absorb and learn, from basic and advanced, improve themselves the reading ability of IT professional English and

enhance the ability to develop cross-platform games and apps.

如何使用這本書 ?

對於非資訊科技或工程背景相關科系的學生或初學者,教師可以利用 " 做手遊學英文初階 (Part1)" 1-8 章作為一個學期的課程,而下學期則使用 " 做手遊學英文初階 (Part2)" 9-16 章來進行教學。然而對於是資訊科技相關科系的學生則可兩本合用來進行一學期的教學,另外 " 做手遊學英文進階 " 則須立用另外一學期的時間來教授。但教師仍需依照學生的程度與學習的速度來做調整。而對於自修學習者可依個人的學習的速度在短時間內從無到有,快速到吸收與學習,從基礎與進階,提昇個人資訊類專業英語之閱讀能力與開發跨平台遊戲與 App 製做之實作能力。

Errata

Although the author has taken every care to ensure the accuracy of book content, mistakes do happen. If you find a mistake in one of my books—maybe a mistake in the text or the code—the author would be grateful if you would report this to me. By doing so, you can save other readers from frustration and help the author improve subsequent versions of this book. If you find any errata, please report them by sending email to [email protected].

勘誤表

儘管作者已經盡力確保書籍內容的準確性,但錯誤確實會發生。如果您在我的書中發現錯誤 - 可能是文本或程式碼中的錯誤 - 如果您向我報告,作者會很非常感激。透過如此作法,您可以使其他讀者免於沮喪,並幫助作者改進本書的後續版本。如果您發現任何勘誤,敬請發送電子郵件至 [email protected]

Supporting Website

You might want to visit www.biec.com.tw/moodle/ for support files and downloads related to your book.

支援網站

您可能需要連結到 www.biec.com.tw/moodle/ 以獲取與您的圖書相關的支援檔案和下載。

I

目 錄

Unit 1 Introducing Cross-platform 2D Game Engine Corona (1) ............................. 1-1

單元一 Corona 跨平台遊戲引擎開發工具介紹與使用 (1) ..................................... 1-1

1.1 Introducing to Corona ....................................................................................1-2

Corona 介紹 .....................................................................................................1-2

1.2 How to install Corona on Windows. ..................................................................1-5

如何安裝 Corona 於 Windows 環境 . ................................................................1-5

1.3 How to install Sublime Text 3 on Windows. ..................................................... 1-10

如何安裝 Corona 於 Windows 環境 . ............................................................. 1-10

1.4 Installing a Corona plugin into Sublime Text 3 editor and launching a project. 1-14

如何安裝 Corona 插件到 Sublime 編輯器當中並啟動一個專案。 .................. 1-14

1.5 Corona official website and learning resource. ............................................... 1-23

Corona 官方網站與學習資源介紹 ................................................................. 1-23

Unit 2 Introducing Cross-platform 2D Game Engine Corona (2) ............................... 2-1

單元二 Corona 跨平台遊戲引擎開發工具介紹與使用 ( 二 ) .................................. 2-1

2.1 How to install Corona and Sublime Editor on Mac OS X ....................................2-2

如何安裝 Corona 和 Sublime 於 Mac OS X 環境 ...............................................2-2

2.2 How to install a Corona plugin into Sublime Editor (Mac OS) . ......................... 2-14

如何安裝 Corona 插件到 Sublime 編輯器當中 (Mac OS ) ............................... 2-14

2.3 Testing the first sample code "HelloWorld" on Corona Device Simulator. ....... 2-19

嘗試在模擬器上執行範例程式 "Hello Word" ................................................ 2-19

2.4 Introducing Sublime Text Editor for Corona ..................................................... 2-22

Sublime Text 編輯器功能介紹 ........................................................................ 2-22

Unit 3 Deploying Corona Sample Projects to Android Devices ................................ 3-1

單元三 使用 Corona 將範例發佈 APK 至 Android 設備 ......................................... 3-1

3.1 Building an APK file of "HelloWorld" project on Mac and Windows. .................3-2

將 "Hello World" 範例發佈成 APK 檔(Mac 跟 Win)......................................3-2

3.2 Deploying an APK file on Android devices. ...................................................... 3-17

APK 檔安裝在 Android 平台設備上 ............................................................... 3-17

II

Unit 4 Deploying Corona Sample Projects on iOS Devices ....................................... 4-1

單元四 將 Corona 範例專案發佈至 iOS 設備 ......................................................... 4-1

4.1 Applying for an Apple ID ...................................................................................4-2

Apple ID 申請 ...................................................................................................4-2

4.2 Generating and downloading an iOS developer certificate in order to deploy

sample project on iOS devices for testing ........................................................4-8

產生並下載 iOS 開發者證書,以便能將範例程式部署到 iOS 測試設備上 ......4-8

4.3 Download and install Xcode ........................................................................... 4-20

Xcode 下載安裝與 Apple ID 登入 ................................................................... 4-20

4.4 Executing Xcode and testing a sample game on iOS device simulator .............. 4-25

iOS 平台設備模擬器上執行 Xcode 遊戲範例 ................................................. 4-25

4.5 Deploying "HelloWorld" sample code to iOS devices ....................................... 4-29

"Hello World" 範例透過 Corona SDK 發佈 iOS 平台設備 ................................ 4-29

Unit 5 Code Review for HelloWord Project .............................................................. 5-1

單元五 範例程式 "Hello World" 說明 .................................................................... 5-1

5.1 Building your first HelloWord project ...............................................................5-2

構建您的第一個 Hello World 專案 ...................................................................5-2

5.2 Understanding the code of HelloWorld project. ................................................5-8

"Hello World" 程式編碼解說 ............................................................................5-8

5.3 Editing and modifying the code of HelloWorld project and run it on simulator 5-17

"Hello World" 程式編碼嘗試修改與模擬器執行 ............................................ 5-17

5.4 Explaining the coordination system of Corona SDK ......................................... 5-25

Corona SDK 座標系統說明 .............................................................................. 5-25

Unit 6 Making Use of the Learning Environment for Corona and Understanding Lua

Programming Language ................................................................................. 6-1

單元六 善用 Corona 學習環境與認識 ................................................................... 6-1

Lua 程式語言 ........................................................................................ 6-1

6.1 Introducing Corona API and library ..................................................................6-2

Corona 函數庫使用說明 ...................................................................................6-2

6.2 Compiling Lua files in Sublime Text 3 on Windows .......................................... 6-17

在 Windows 平台上使用 Sublime Text 3 編譯 Lua 的語言 ............................. 6-17

III

6.3 Compiling Lua files in Sublime Text 3 on Mac .................................................. 6-22

在 Mac 平台上使用 Sublime Text 3 編譯 Lua 的語言 ...................................... 6-22

6.4 Understanding Lua programming Language .................................................... 6-28

認識 Lua 程式語言 .......................................................................................... 6-28

Unit 7 Applying a Version Control System to Corona Projects ................................. 7-1

單元七 Corona 專案開發導入版本控制 ................................................................. 7-1

7.1 Introducing version control using Github ........................................................7-2

版本控制 Github 介紹 ......................................................................................7-2

7.2 Installing Github for Corona project's version control ...................................... 7-10

安裝 Github .................................................................................................... 7-10

7.3 Using version control for a Corona project. .................................................... 7-20

如何運用版本控制在 Corona project 上 . ...................................................... 7-20

Unit 8 Debugging Information, Loop Control ........................................................ 8-1

and Animation Procedure for Corona and Animation Procedure for Corona 8-1

單元 8 Corona 之除錯資訊、迴圈控制與動畫程序 ............................................... 8-1

8.1 Using Sublime Text debug to evaluate the errors of Corona SDK code ...............8-2

在編譯器中檢視錯誤訊息 ................................................................................8-2

8.2 Using Corona debugger to debug your code .................................................... 8-13

如何使用 Corona 除錯器來幫你的程式來除錯 .............................................. 8-13

8.3 Explaining the Sample Code of FrameAnimation1 Project Step by Step .......... 8-21

詳細說明 FlameAnimation1 範例程式 ............................................................ 8-21

8.4 Introduction to programming flow chart ......................................................... 8-30

程式流程圖說明 ............................................................................................. 8-30

IV

Unit 1 Introducing Cross-platform 2D Game Engine Corona (1)

單元一 Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

1.1 Introducing Corona

Corona 介紹

1.2 How to install Corona on Windows.

如何安裝 Corona 於 Windows 環境 .

1.3 How to install Sublime Text 3 on Windows.

如何安裝 Corona 於 Windows 環境 .

1.4 How to Install a Corona Plugin into

Sublime Text Editor and launch a project.

如何安裝 Corona 插件到 Sublime Text

編輯器當中並啟動一個專案 .

1.5 Corona official website and learning

resource

Corona 官方網站與學習資源介紹My name is Wonder and

nickname is called "Verb".

1-2 1-3

‘ Learning English by Making Mobile Games—Fundamental 1

1.1 Introducing to Corona

Corona 介紹

Why use Corona?

為什麼使用 Corona ?

Easy-to-learn for beginners and a powerful tool for professional developers

對初學者易於學習而對專業開發人員提供了強大工具

Corona is a cross-platform framework 2D game engine that aims for rapidly creating apps and games for mobile devices and desktop systems. That means you can create your project once and deploy it on multiple types of devices such as Apple iPhone and iPad, Android phones and tablets, Amazon Fire, Mac Desktop, Windows Desktop, and even connect to any digital media player device including Apple TV, Fire TV, and Android TV.

Corona 是一個跨平台框架的 2D 遊戲引擎,旨在為移動設備和桌面系統快速創建應用程式和遊戲。這意味著您可以創建專案一次,並將其部署到多種類型的設備,如 Apple iPhone、iPad,Android 手機、平板電腦、Amazon Fire、Mac Desktop 與Windows Desktop,甚至能連接到電視,包括 Apple TV,Fire TV 和 Android 電視。

The features of Corona

Corona 的功能

No limits – Unlimited. Powerful. Free.

沒有限制 -- 無限制 、強大、自由。

Lua-based

基於 LUA 語言而發展的

Lua is an open source scripting language designed to be lightweight, fast, yet also powerful. Lua is also currently the leading scripting language in games and has been utilized in Warcraft ™, Angry Birds ™, Civilization ™ and many other popular franchises. Designers also tend to love Lua because it's very approachable and it offers plain, forgiving syntax — if you've never coded before, Lua and Corona is a perfect place to start!

Lua 是一種開源腳本語言,旨在輕量化,快速而又強大。 Lua 也是遊戲中領先的腳本語言,已經在 " 魔獸爭霸 ™"," 憤怒的小鳥 "," 文明 " 等許多受歡迎的與特

1-2 1-3

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

許經營中驗證了其效用。設計師也傾向於使用 Lua,因為它是非常平易近人的,它提供簡單而寬容的語法 - 如果你以前從未寫過程式,Lua 和 Corona 是一個完美的開始!

Mature and time-tested

成熟並經過時間的考驗

Over the span of 8 years Corona has evolved into a mature, battle-tested framework. Over 1000 APIs give you access to sprite animations, audio and music, Box2D physics, object tweening, advanced graphical filters, particle emitters, networking, system controls, texture management, native elements, data, and much more.

在過去 8 年的時間裡,Corona 已經演變成一個成熟的與經過戰場淬煉的架構。可讓您使用超過 1000 個 API 精靈動畫、音頻和音樂、Box2D 物理、物件補間、高級圖形過濾器、粒子發射器、網絡、系統控制、紋理管理、原生元素與數據等等

Plugins for all needs

滿足所有需要的插件

Select from numerous plugins which extend the Corona core for features like in-app advertising, analytics, media and much more. Corona's core is already rich with features, but if you need more, there are many plugins in the Corona Marketplace which extend Corona even further! Everything from in-app advertising, analytics, media, hardware features, and more are within your reach through a selection of almost 200 plugins, and that number continues to grow.

從眾多的擴充的 Corona 核心的插件中選擇適用於 in-APP 廣告、分析與媒體等功能的插件。 Corona 的核心已經有非常豐富的功能,但是如果您需要更多的功能,Corona 市集上有許多插件可以進一步來擴充 Corona 的功能!來自應用內購 (in-APP) 廣告,分析,媒體,硬件功能等的所有內容,都可以透過選擇近 200 個插件來實現,而且這一數字在不斷增長中。

Call any native library

能夠呼叫任何原生的程式庫

If it's not already in the core or supported via a plugin, you can call any native (C/C++/Obj-C/Java) library or API using Corona. You can even monitor projects instantly on multiple devices using Live Builds. These features and more are all part of the Corona ecosystem!

1-4 1-5

‘ Learning English by Making Mobile Games—Fundamental 1

如果還無法透過插件支援核心程序,可以使用 Corona 呼叫任何(C / C ++ / Obj-C / Java)源生庫或 API。甚至可以使用 Live Builds 在多台設備上即時監控專案。這些功能和更多都是 Corona 生態系統的一部分!

Real-time simulation

即時模擬

Paired with an IDE or text editor that you're already comfortable with, the interactive Corona Simulator will respond to your code changes instantly, providing a real-time preview of what your app will look like — and how it will behave — on actual devices. Everything from graphics to animations, simulated physics to beautiful particle effects, the Corona Simulator streamlines your workflow and lets you see changes instantly.

能夠配對您已經熟悉的 IDE 或文本編輯器,交互式的 Corona Simulator 可以立即回應您的程式的更改,在實際設備上即時預覽您的應用程序的外觀和操作方式。一切從圖形到動畫,模擬物理到美麗的粒子效應,Corona Simulator 簡化了你的工作流程,讓你立即看到變化。

Cross-platform

跨平台

Develop for mobile, desktop, and connected TV devices with just one code base.

開發行動,桌面和連接的電視設備只需一個程式庫就可達到。

Completely free

完全免費

No hidden fees, charges, or royalties.

Whether you are an indie developer or a large publisher, you will never pay for core functionality.

沒有隱藏的費用,成本、或特許權使用費。

無論您是獨立開發商還是大型發行商,您都不需對 Corona 核心功能支付費用。

1-4 1-5

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

1.2 How to install Corona on Windows.

如何安裝 Corona 於 Windows 環境 .

Step 1:Go to Corona official website. www.Coronalabs.com (Figure. 1-1)

步驟 1:連結到 Corona 官方網站 www.Coronalabs.com ( 圖 1-1)

Figure 1-1 Official Website of Corona labs.圖 1-1 Coronal labs 官網

Step 2:Register an account (see Figure 1-2 ).

步驟 2:註冊一個帳號 ( 如圖 1-2)

Figure. 1-2 Login and Registration page of Corona.

圖 1-2 註冊及登入 Corona 網站

1-6 1-7

‘ Learning English by Making Mobile Games—Fundamental 1

Step 3:Click on "Download Corona" (see Figure. 1-3).

步驟 3:點選下載 Corona ( 如圖 1-3)

Figure. 1-3 Welcome page when you log-in the website of Corona.

圖 1-3 登錄 Corona 的網站後,網站的歡迎頁面

Step 4:Click Download (see Figure. 1-4)

步驟 4:點選下載 ( 圖 1-4)

Figure. 1-4 Download page of Corona installation files.

圖 1-4 Corona 安裝文件的下載頁面

Step 5:Complete the download (Figure. 1-5)

步驟 5:完成下載 ( 圖 1-5)

1-6 1-7

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Figure.1-5 Responsive page when Corona installation file has been downloaded.

圖 1-5 Corona 安裝文件下載後的回應頁面

Step 6:Execute the installation file ( see Figure. 1-6)

步驟 6:執行安裝檔 ( 圖 1-6)

Figure. 1-6 Setup and the License Agreement confirmation page.

圖 1-6 安裝與許可協議確認頁面。

If you want to use Sublime Text 3 as the editor for Corona, you should change the installation folder to "C:\Programe Files(x86)\Corona labs\Corona \ " instead of "…..\

1-8 1-9

‘ Learning English by Making Mobile Games—Fundamental 1

Corona labs\Corona". (Figure. 1-7/1-8/1-9/1-10)

假如你是用 Sublime Text 3 作為編輯器時,你應該要更改安裝路徑位置 "C:\Programe Files(x86)\Corona labs\Corona\" 而 不 是 "…..\Corona labs\Corona" ( 圖1-7/1-8/1-9/1-10)

Figure. 1-7 Default directory the Corona is going to install.

圖 1-7 Corona 將要安裝的預設目錄

Figure. 1-8 Confirmation of starting to install Corona.

圖 1-8 安裝 Corona 的確認

1-8 1-9

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Figure.1-9 Copying New files to installation folder.

圖 1-9 將新文件複製到安裝文件夾

Figure. 1-10 Completion of installing Corona.

圖 1-10 完成安裝 Corona

Step 7:Login account (Figure. 1-11)

步驟 7:登入帳號 ( 圖 1-11)

1-10 1-11

‘ Learning English by Making Mobile Games—Fundamental 1

Figure.1-11 Launching Corona for the first time.

圖 1-11 第一次啟動 Corona

Step 8:Complete the login process (see Figure 1-12 ).

步驟 8:完成登入 ( 圖 1-12)

Figure. 1-12 Indication of starting to use Corona.

圖 1-12 開始使用 Corona 的指示

1.3 How to install Sublime Text 3 on Windows.

如何安裝 Corona 於 Windows 環境 .

1-10 1-11

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Step 1:Go to Sublime Text official website ( see Figure 1-13).

步驟 1:到 Sublime Text 官方網站 ( 圖 1-13)

Figure. 1-13 Sublime Text official website.

圖 1-13 Sublime Text 官方網站

Step 2: Go to the download folder and locate the installation file of Sublime Test 3

(Figure 1-14)

步驟 2:到下載位置安裝 Sublime Test 3 ( 圖 1-14)

Figure. 1-14 Download and installation file of Sublime Test 3

圖 1-14 下載及安裝 Sublime Test 3

Step 3: Execute the installation file (see Figure. 1-15).

步驟 3:執行安裝檔 ( 圖 1-15)

1-12 1-13

‘ Learning English by Making Mobile Games—Fundamental 1

Figure. 1-15 Execute the installation file.

圖 1-15 執行安裝文件

Figure. 1-16 Enter the path where the file is placed.

圖 1-16 輸入放置檔案的路徑

1-12 1-13

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Figure. 1-17 Add Explorer context menu.

圖 1-17 加入 Explorer 瀏覽器的本文選單中

Figure. 1-18 Confirmation of staring to install Sublime Text 3.

圖 1-18 確認安裝 Sublime Text 3

1-14 1-15

‘ Learning English by Making Mobile Games—Fundamental 1

1.4 Installing a Corona plugin into Sublime Text 3 editor and launching a project.

如何安裝 Corona 插件到 Sublime 編輯器當中並啟動一個專案。

Figure. 1-19 Completion of installing Sublime Text 3.

圖 1-19 完成安裝 Sublime Text 3

Figure. 1-20 Launch Sublime Text 3 on Windows.

圖 1-20 在 Windows 開啟 Sublime Text 3

1-14 1-15

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Step 1:In Sublime Text choose: Tools > Command Palette… (Figure 1-21)

步驟 1:在 Sublime Text 選擇 Tools > Command Palette… ( 圖 1-21)

Figure. 1-21 A pop up window with lots of commands appears.

圖 1-21 出現了一個彈出視窗,條列了很多指令

Step 2:Type "Install Package Control" in the empty white bar as shown in Figure.1-22.

Package Control is installed as a Sublime Text 3 command. This means it is

easily accessed via the Command Palette detailed previously. Once in the

Command Palette, typing "Install Package Control " will limit the choices to

only the Package Control options shown in the following screenshot:

步驟 2:在空白欄中輸入“Install Package Control”,如圖 1-22 顯示,Install

Package Control”作為 Sublime Text 3 的安裝指令。這意味著它可以事先

經由調色板的指令輕易地被存取。在命令調色板中,透過安裝軟體控制

的篩選:將選擇專案僅限於選項範圍內,如以下螢幕截圖中顯示的套裝

軟體控制選項。

1-16 1-17

‘ Learning English by Making Mobile Games—Fundamental 1

Figure. 1-22 Input " Install Package Control" setting screenshot.

圖 1-22 輸入 " 安裝套裝軟體控制 " 設置螢幕截圖

Step 3:Click Enter to complete Package complete installation procedure. (Figure. 1-23)

步驟 3:按 Enter 鍵來完成 Package Control 的安裝。( 圖 1-23)

Figure. 1-23 The screenshot showing the Package Control was successfully installed.

圖 1-23 顯示套裝軟體控制的螢幕截圖已成功安裝

Step 4: After the list has loaded, a pop up appears again ( see Figure 1-24 ).

1-16 1-17

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

步驟 4: 列表加載完畢後,再次出現彈出視窗(圖 1-24)

Figure. 1-24 The search list for the Corona Editor.

圖 1-24 Corona Editor 的搜索列

You can see an equal sign moving at the bottom. This is the Sublimes indicator for loading: The Package Control plugin loads a list of available packages you can install. The list should also contain our Corona Editor we would like to install.

在底部你可以看到一個等號移動。這是用於加載的 Sublimes 指示器:套裝軟體控制插件加載可安裝的可用套裝軟體的列表。該列表還應包含我們要安裝的 Corona編輯器。

Again, to find our plugin we can start typing in the search field to quickly filter the list.

再次,為了找到我們的插件,我們可以開始輸入搜索字串來快速篩選列表。

Start typing Corona Editor. After some letters you should already see the Corona Editor entry (see Figure. 1-25).

開始鍵入 Corona Editor。收到訊息後,您應該已經看到 Corona Editor 專案。( 圖1-25)

1-18 1-19

‘ Learning English by Making Mobile Games—Fundamental 1

Figure. 1-25 Type Corona Editor to look for the entry to install Corona Editor.

圖 1-25 輸入 Corona Editor 以搜尋安裝 Corona Editor 的專案

Select it and press Return or click on it to install it. When you see Figure. 1-26, that means the installation of Corona Editor for Sublime Text 3 has been completed.

用游標鍵選擇並按返回或點擊它來進行安裝。當你看到圖 1-26,這意味著安裝Corona Editor for Sublime Text 3 已經完成了。

Figure. 1-26 The final screenshot of the installation of Corona Editor in Sublime Text 3.

圖 1-26 在 Sublime Text 3 安裝 Corona Editor 的最後一個螢幕截圖

1-18 1-19

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Restarting Sublime Text 3, before using Corona Editor is recommened.

安裝了 Corona Editor插件後。在使用 Corona Editor之前,建議重新啟動 Sublime。

Launching a project

啟動一個專案

Step 1:Locate the Sample Code of Corona in your Windows directory.

The sample code of Corona is stored under the folder "c:/Program Files(x86)/

Corona Labs/Corona SDK/ ". Open the window directory of sample as shown

in Figure. 1-27.

步驟 1:在 Windows 目錄中找到 Corona 的範例程式碼。

Corona 的範例程式碼存儲在文件夾 "c:/ Program Files(x86)/ Corona

Labs / Corona SDK/" 下)。打開範例目錄,如圖 1-27 顯示。

Figure.1-27 The sample code folder of Corona.

圖 1-27 Corona 的範例程式碼文件夾

1-20 1-21

‘ Learning English by Making Mobile Games—Fundamental 1

Step 2:Copy and paste the entire <Sample Code> folder from installation folder to

the desktop (see Figure. 1-28 ).

步驟 2:將範例程式碼文件夾從其目錄拖曳到桌面,將整個 <Sample Code> 文件

夾從安裝文件夾複製到桌面(圖 1-28)。

Figure. 1-28 Copy and Paste the entire Sample Code floder to the desktop.

圖 1-28 將“範例程式碼”的整個文件夾複製到桌面

Step 3:Drag the folder HelloWorld to the upper left corner of Sublime Text Editor.

You can see the project files within the HelloWord is listed on the left

Windows of Sublime Text Editor as shown in (Figure. 1-29).

步驟 3:將文件夾 HelloWorld 拖曳到 Sublime Text Editor 的左上角。您可以看到

HelloWord 中的專案文件列在左邊的視窗的 Sublime Text 編輯器,如(圖

1-29)顯示。

1-20 1-21

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Figure. 1-29 Dragging the folder HelloWorld to Sublime Text Editor.

圖 1-29 將文件夾 HelloWorld 拖曳到 Sublime 文字編輯器

Step 4:Click the file main.lua in HelloWord project as shown in Figure 1-30.

步驟 4:點選 main.lua 檔案 ( 如圖 1-30)。

Figure.1-30. HelloWorld project is being opened in Sublime Text Editor.

圖 1-30 HelloWorld 專案已在 Sublime Text Editor 中打開

1-22 1-23

‘ Learning English by Making Mobile Games—Fundamental 1

Step 5:Click Corona Editor -> Run Project as shown in Figure.1-31.

步驟 5:點選 Corona Editor -> Run Project 如圖 1-31。

Figure. 1-31 Click on Corona Editor > Run Project or Win key + F10.

圖 1-31 點擊 Corona Editor 編輯器 > 運行專案或 Win 鍵 + F10

Step 6:Click Enter key and you will see the simulator showing the HelloWorld Project

as shown in Figure. 1-34. Congratulations! You just made your first Corona app

on your Mac.

步驟 6:點擊 Enter 鍵,您將看到顯示 HelloWorld 的模擬器專案如圖 1-32 所示。

恭喜!你完成了你的您的 Mac 上第一個 Corona 應用程序。

1-22 1-23

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Figure. 1-32 Running Project HelloWorld in Corona simulator.

圖 1-32 在 Corona 模擬器中運行 Project HelloWorld

1.5 Corona official website and learning resource.

Corona 官方網站與學習資源介紹

Click on the quick link icon on the desktop to link to the Website

portal ( as shown in Figure. 1-35 ) for Corona developers.

點擊快速鏈接圖標 在桌面上連接到網站入口 (如圖 1-35 所示)為 Corona

開發人員。

1-24 1-25

‘ Learning English by Making Mobile Games—Fundamental 1

Figure.1-33 Corona developer portal

圖 1-33 Corona 開發者入口網站

Click on Getting Started to start using Corona learning resources ( see Figure 1-34).

點擊入門開始使用 Corona 學習資源。 (圖 1-34)

Figure.1-34 Getting Started information on Corona developer portal.

圖 1-34 開始取得 Corona 開發者入口網站的訊息

1-24 1-25

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Click on Sample to view all sample codes (see Figure. 1-35 ).

點擊範例查看所有範例程式碼(圖 1-35)

Figure.1-35 Sample code linkage on Corona developer portal.

圖 1-35 Corona 開發者入口的範例程式碼連接

Click on Developer Guides to have a whole view of API Reference ( see Figure 1-36 ).

點擊開發人員指南以取得 API 參考的全部視圖。 (圖 1-36)

Figure.1-36 API Reference information on Corona developer portal.

圖 1-36 Corona 開發者入口 API 參考訊息

1-26 1-27

‘ Learning English by Making Mobile Games—Fundamental 1

Click on Demos to look at 4 demo projects ( see Figure 1-37 ).

點擊範例查看 4 個示範專案(圖 1-37)

Figure.1-37 4 demo projects on Corona developer portal.

圖 1-37 Corona 開發者入口 4 個示範專案

Click on Ads/Monetization to learn how to make money from different monetization methods ( see Figure 1-38 ).

點擊廣告 / 營利,了解如何通過不同的獲利方式賺錢。(圖 1-38)

Figure.1-38 Monetization methods on Corona developer portal.

圖 1-38 Corona 開發者入口網站上的貨幣化方法

1-26 1-27

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Click on Request a Feature to request a function that Corona doesn't have at the moment ( see Figure 1-39 ).

點擊 Request a Feature 以請求 Corona 目前沒有的功能(圖 1-39)

Figure.1-39 Request forms on Corona developer portal.

圖 1-39 Corona 開發者入口網站申請表

Click on Documentation to look at detailed information about a specific function ( see Figure 1-40 ).

點擊文檔查看有關特定功能的詳細訊息。 (圖 1-40)

Figure.1-40 Documentation linkage on Corona developer portal.

圖 1-40 Corona 開發者入口網站上的文件檔連接

1-28 1-29

‘ Learning English by Making Mobile Games—Fundamental 1

Click on Marketplace to search for existing plugins available in Corona Marketplace (see Figure 1-41).

點擊 Marketplace 搜索 Corona Marketplace 中現有的插件。 (圖 1-41)

Figure.1-41 Marketplace information on Corona developer portal.

圖 1-41 Corona 開發者入口網站市場訊息

Click on Forums to select an interesting topic you would like to explore or look for an answer to any questions you may have on developing an App or game (see Figure 1-42 ) .

點擊 Forums 選擇一個有趣的話題,您可以在開發應用程序或遊戲時探索或尋找問題的答案。 (圖 1-42)

1-28 1-29

1Corona 跨平台遊戲引擎開發工具介紹與使用 (1)

Figure.1-42 Forum information on Corona developer portal.

圖 1-42 關於 Corona 開發者入口網站的討論區訊息

Click on New Project to open the assistant window to create a new project of any types ( see Figure 1-43 ).

點擊“新建專案”以打開助理視窗以創建所有類型的新專案。 ( 圖 1-43)

Figure.1-43 Create a new projectthrough Corona.

圖 1-43 透過 Corona 創建一個新專案

1-30 2-1

‘ Learning English by Making Mobile Games—Fundamental 1

1-30 2-1

Unit 2 Introducing Cross-platform 2D Game Engine Corona (2)

單元二 Corona 跨平台遊戲引擎開發工具介紹與使用 ( 二 )

2.1 How to install Corona and Sublime Editor on Mac OS X

如何安裝 Corona 和 Sublime 於 Mac OS X 環境

2.2 How to install a Corona plugin into Sublime Editor (Mac OS X)

如何安裝 Corona 插件到 Sublime 編輯器當中 (Mac OS X)

2.3 Testing the first sample code "Hello World" on Corona device

simulator.

嘗試在模擬器上執行範例程式

"Hello Word"

2.4 Introducing Sublime Text Editor

Sublime Text 編輯器功能介紹

My name is Strip and my nickname is called "Noun".

2-2

‘ Learning English by Making Mobile Games—Fundamental 1

2.1 How to install Corona and Sublime Editor on Mac OS X

如何安裝 Corona 和 Sublime 於 Mac OS X 環境

Downloading and installing Corona

下載並安裝 Corona

You have the option to choose the MacOS X or Microsoft Windows operating system to develop Corona programme. Keep in mind the following system requirements that are needed to run the program. The most compatible version used for this course is Build 2018.3326.

您可以選擇 MacOS X 或 Microsoft Windows 操作系統來開發 Corona 程序。要注意的是運行程序所需的以下系統要求。本課程最相容的版本是 Build 2018.3326。

If you are installing Corona for Mac OS X, be sure that your system has the following features:

如果您正在安裝 Corona for Mac OS,請確保您的系統具有以下功能:

Corona for MacOS supports building applications for iOS, Android, tvOS, and MacOS desktop. It requires the following basic system elements:

MacOS 的 Corona 能開發 iOS,Android,tvOS 和 MacOS 桌面等不同平台之應用程序。它需要以下基本系統規格要求:

MacOS 10.11 or later

MacOS 10.11 或更高版本

Xcode (minimum version allowed by Apple to submit apps to the App Store)

Xcode(蘋果允許向 App Store 提交應用的最低版本)

-----------------------------------------------------------------------------------------------------------------

Notes ( 注意 )

*We only support iOS devices that run iOS 8.0 or higher.

我們只支援運行 iOS 8.0 或更高版本的 iOS 設備

*We only support Android devices that run Android 4.0.3 or higher with an ARMv7

Unit 3 Deploying Corona Sample Projects to Android Devices

單元三 使用 Corona 將範例發佈 APK 至Android 設備

3.1 Building a APK File of "Hello World" project on

Mac and Windows for Corona

將 "Hello World" 範例發佈成 APK 檔

(Mac 跟 Win)

3.2 Deploying APK file to Android devices

APK 檔安裝在 Android 平台設備上

My name is Ash and my nickname is called "Adverb".

3-2

‘ Learning English by Making Mobile Games—Fundamental 1

3.1 Building an APK file of "HelloWorld" project on Mac and Windows.

將 "Hello World" 範例發佈成 APK 檔(Mac 跟 Win)

For most students, the number of having an Android phone is bigger than the number of having an iPhone. Therefore, in this unit we are going to demonstrate how to build a APK file of "HelloWorld" Project in order to test it on Android devices.

對於大多數學生來說,擁有 Android 手機的人數大於擁有 iPhone 的人數。因此,在本單元中,我們將展示如何構建 "HelloWorld" 專案的 APK 文件,以便在Android 設備上進行測試。

Testing applications on an Android device

Creating and testing the Android builds on an Android device does not require a developer account like how an Apple developer does for iOS devices. The only tools we need to build for Android are a PC or Mac, Corona , JDK installed, and an Android device. If you plan on submitting an app to the Google Play Store, you'll need to sign up as a Google Play Developer at following URL

https://play. Google.com/apps/publish/signup/.

There is a one-time $25 registration fee you have to pay if you want to publish software on the Google Play Store.

you can pay with the following credit or debit cards:

MasterCard

Visa

American Express

Discover (U.S. only)

Visa Electron (Outside of the U.S. only)

Note: The types of cards accepted may vary by location.

在 Android 設備上測試應用程序

不像 Apple 開發人員對 iOS 設備的操作那樣,在 Android 設備上創建和測試Android 版本的 APK 是不需要開發者帳戶。我們需要為 Android 構建的唯一工具是一台 PC 或 Mac、Corona 、已安裝好的 JDK 和 Android 的行動設備。如果您計劃將應用提交到 Google Play 商店,則需要以下 URL 註冊為 Google Play 開發者

https://play. Google.com/apps/publish/signup/.

如果您想在 Google Play 商店上發佈應用軟體,您必須支付一次性 25 美元的註冊

Unit 4 Deploying Corona Sample Projects on iOS Devices

單元四 將 Corona 範例專案發佈至iOS 設備

4.1 Applying for an Apple ID

Apple ID 申請

4.2 Generating and downloading an iOS developer certificate in order to

deploy sample project on iOS Devices for testing

產生並下載 iOS 開發者證書,以便能將範例程式部署到 iOS 測

試設備上

4.3 Downloading and installing Xcode

Xcode 下載安裝與 Apple ID 登入

4.4 Executing Xcode sample games on iOS devices

iOS 平台設備上執行 Xcode 遊戲範例

4.5 Deploying "HelloWorld" sample code on iOS

devices

"Hello World" 範例透過 Corona SDK 發佈 iOS 平

台設備

My name is Dazy and my nickname is called "Adjestive".

4-2

‘ Learning English by Making Mobile Games—Fundamental 1

4.1 Applying for an Apple ID

Apple ID 申請

Why do you need an Apple ID?

In order to develop any iOS application, you will need to enroll in the Apple Developer Program, which costs $99 a year, and create an account on the Apple website at http:// developer.apple.com/programs/iOS/ by following these steps:

為什麼你需要一個 Apple ID ?

為了開發任何 iOS 應用程序,您需要每年花費 99 美元去註冊成為 Apple 開發人員計畫會員,並在 Apple 網站 http:// developer.apple.com/programs/iOS/ 上創建一個帳戶,方法如下這些步驟:

Figure 4-1 Developer enrollment website for Apple developer program.

圖 4-1 蘋果開發人員計劃的開發人員註冊網站

Your Apple ID is the account you use to access Apple services like the iTunes Store, App Store, iBooks Store, iCloud, iMessage, Apple Music, or Apple News. You can sign in to all Apple services with a single Apple ID and password.

您的 Apple ID 是您用於訪問 Apple Store 服務的帳戶,如 iTunes Store,App Store,iBooks Store,iCloud,iMessage,Apple Music 或 Apple News。您可以使用單個 Apple ID 和密碼登錄所有 Apple 服務。

Unit 5 Code Review for HelloWord Project

單元五 範例程式 "Hello World" 說明

5.1 Building your first HelloWord project

構建您的第一個 Hello World 專案

5.2 Understanding the code of HelloWorld

"Hello World" 程式編碼解說與了解

5.3 Editing and modifying the code of HelloWorld

project and running it on simulator

"Hello World" 程式編碼嘗試修改與模擬器執行

5.4 Explaining the coordination system of Corona

Corona 座標系統說明

My name is Papaya and my nickname is called "Preposition".

5-2

‘ Learning English by Making Mobile Games—Fundamental 1

5.1 Building your first HelloWord project

構建您的第一個 Hello World 專案

Now that we have the Corona simulator and Sublime Text editors set up, let's start building our very first Corona program! The first program that we will build is called HelloWord. It is a traditional program that many people learn when starting a new programming language.

現在我們設置了 Corona 模擬器和模擬文字編輯器,讓我們開始構建我們第一個Corona 程序!我們將建立的第一個程序叫做 Hello World。這是一個傳統的程序,許多人在開始新的程式語言時學習時的第一個程式。

Step 1:Call up Corona Simulator by clicking the Corona Simulator icon on your

desktop see Figure 5-1.

步驟 1:通過點選您的 Corona 模擬器按鈕來呼叫 Corona 模擬器 桌面如圖 5-1。

Figure 5.1 Corona Simulator.

圖 5.1 Corona 模擬器

Step 2:Click on New Project button and a dialog window pop up as seen in

Unit 6 Making Use of the Learning Environment for Corona and Understanding Lua Programming Language

單元六 善用 Corona 學習環境與認識 Lua 程式語言

6.1 Introducing Corona API and library

Corona 函數庫使用說明

6.2 Compiling Lua files in Sublime Text 3 on Windows

在 Windows 平台上使用 Sublime Text 3 編譯 Lua 的語言

6.3 Compiling Lua files in Sublime Text 3 on Mac

在 Mac 平台上使用 Sublime Text 3 編譯 Lua 的語言

6.4 Understanding Lua programming language

認識 Lua 程式語言

My name is Tricky and my nickname is called "Pronoun".

6-2

‘ Learning English by Making Mobile Games—Fundamental 1

6.1 Introducing Corona API and library

Corona函數庫使用說明

The author selects the Corona as the development tool for teaching programming and mobile app development for the following several good reasons:

作者選擇 Corona作為程式教學和行動應用程序開發的開發工具,具有以下幾個好的原因:

1. Corona by Corona Labs (http://www.coronalabs.com) was developed from the

beginning around the concept that anyone can make mobile apps.

Corona 由 Corona Labs(http://www.coronalabs.com)所發展,本著讓任何人都可

以製作行動應用程序的概念持續地發展下來。

2. Using the Lua scripting language, Corona is easy to learn yet powerful enough to allow you

to create great, powerful apps and fast, responsive games.

使用 Lua 腳本語言,Corona 易於學習,而且功能強大,可以讓您創建出色,強大的應用

程序和快速響應的遊戲。

3. Finally, the international community that has formed around Corona is one of the best,

developer friendly environments that I have ever experienced in my 30+ years of

programming. I hope that you enjoy learning to develop your own mobile apps while learning

professional English at the same time.

最後,伴隨 Corona 組建的國際社群是我在 30 多年程式中遇到的最好的開發者友好環

境之一。我希望你喜歡學習開發自己的行動應用程序,同時學習專業英語。

Hi, this is Dr. Twobears and I would like to do a quick overview on how to make use of the Corona documentation as it can be seen in Figure 6-1.

嗨,這是 Twobears博士,我想做一個關於如何使用 Corona文件庫的快速的瀏覽,如圖 6-1 所示。

Unit 7 Applying a Version Control Systemto Corona Projects

單元七 Corona 專案開發導入版本控制

7.1 Introducing version control using Github

版本控制 Github 介紹

7.2 Installing Github for Corona project's version control

安裝 Github 來作為 Corona 專案的版本控制系統

7.3 Using a version control for a Corona project?

如何運用版本控制在 Corona 專案上 ?

My name is Chunk&Eddy and my n ickname i s called "Conjunction".

7-2

‘ Learning English by Making Mobile Games—Fundamental 1

7.1 Introducing version control using Github

版本控制 Github 介紹

What is the version control?

什麼是版本控制?

Version control systems are a category of software tools that help a software development team manage changes to source code over the development of time.

版本控制系統是一類軟體工具,可幫助軟體開發團隊在開發時間內管理原始程式碼的更改

Version control software keeps track of every modification to the code in a special kind of database. If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members. Therefore, it is really an industry requirement skill when you apply for a programming job.

版本控制軟體利用特殊類型資料庫去追踪中程式的每項修改。如果發生錯誤,開發人員可以如時鐘般的迴轉,並比較早期版本的程式,以幫助修復錯誤,同時最大限度地減少對所有團隊成員的干擾。因此,當您申請程式開發工作時,它確實是業界要求必備的技能。

Figure 7-1 Version control semantics diagram.

圖 7-1 版本控制語義圖表

Unit 8 Debugging Information, Loop Control and Animation Procedure for Corona單元 8 Corona 之除錯資訊、迴圈控制

與動畫程序

8.1 Using Sublime Text debug to evaluate the errors of

Corona code.

在編譯器中檢視 Corona 程式碼錯誤訊息

8.2 Using Corona debugger to debug your code errors.

如何使用 Corona 除錯器來幫你的程式來除錯

8.3 Explaining the sample code of FrameAnimation1

project step by step.

詳細說明 FlameAnimation1 範例程式

8.4 Introducing programming flow chart.

程式流程圖介紹

M y n a m e i s M o m o a n d m y n i c k n a m e i s c a l l e d “Interjection”.

8-2

‘ Learning English by Making Mobile Games—Fundamental 1

8.1 Using Sublime Text debug to evaluate the errors of Corona SDK code

在編譯器中檢視錯誤訊息

Using Corona for debugging.

As a developer beginner in programming, you will from time to time encounter problems in your code, including improper usage of an API, incorrect logic, misspelling, or any number of other issues. This guide will teach you how to debug your code, detect some common problems, and find their solutions.

使用 Corona 進行除錯。

作為程式開發人員的初學者,您將經常在程式碼中遇到問題,包括 API 的不當使用,錯誤的邏輯,拼寫錯誤或任何其他問題。這個指南將教您如何除錯,檢測一些常見問題,並找到他們的解決方案。

Normally beginners of computer programming have a tendency to blame the everything to the compiler, the library, or anything other than their own code. Experienced programmers would love to do the same things, but they know that, realistically, most problems are their own fault.

通常,計算機程式設計師的初學者會常會將責任歸咎於編譯器,函式庫或其他任何其他除了不是他本身程式碼的一切問題。有經驗的程式設計師會喜歡做同樣的事情,但他們知道,實際上大多數問題都是自己的錯。

Fortunately, most of the bugs are simple and can be solved with simple techniques. Look at any debugging output before the program crash; if it is possible, you should get a stack trace from a debugger. Now you know something of what happened, and where. Pause to reflect. How could that happen? Reason back from the state of the crashed program to determine what could have caused this.

幸運的是,大多數錯誤是很簡單,可以用簡單的技術來解決。在程式當機之前查看任何輸出的除錯編碼 ; 如果可能,您應該從除錯編碼獲取堆疊追踪資訊。現在你知道發生了什麼,以及在哪裡。暫停去反覆思考。這個是如何發生的?原因是從崩潰程序的狀態反思回來,以確定可能造成的原因。

Using Corona Editor

Corona Editor has an add-on feature and works well with Sublime Text. This allows you to see debugging messages in Sublime Text editor without needing a console window. It also allows you to examine your code using an interactive debugger.