Major Softwares

  INDEX PAGE

  1. 簡介
  2. Java, Android和LibGDX好書推介
  3. Java, Android和LibGDX要學的知識
  4. 用Windows寫Java程式
  5. 用Eclipse寫Java程式
  6. 用Eclipse寫Android程式
  7. 用Eclipse寫LibGDX程式
  8. Standard Java Naming Conventions
  9. System.out.println()的用法和意思
  10. Where is main() method in Android?

LibGDX - Splash & Menu Screen

  1. LibGDX: World, Texture, Background, Camera, Viewport, Screen & OpenGL
  2. LibGDX: Texture, TextureRegion, SpriteBatch & Sprite
  3. UML(Unified Modeling Language): Class Diagram
  4. Type Casting, Upcasting & Downcasting
  5. @Override的用法和意思
  6. LibGDX: Scene2d & Graphical User Interface(GUI)
  7. LibGDX: Splash Screen
  8. LibGDX: Texture Packer
  9. LibGDX: BitmapFonts, JSON & Skin
  10. Android: R.java File
  11. Android: onClick事件的5種實現方式
  12. LibGDX: Game Menu Screen
  13. LibGDX: Advanced Game Menu Screen (using Abstract Screen)
  14. LibGDX: Disposable Interface
  15. Java & LibGDX: super keyword
  16. LibGDX: Advanced Game Menu Screen (using AssetManager)
  17. Java: Array, Arrays, List, ArrayList & LibGDX: Array
  18. LibGDX: File I/O (Preferences)
  19. LibGDX: Game Level Selection Screen
  20. LibGDX: Advanced Game Level Selection Screen (using AssetManager)

LibGDX - Tiled 2D Platform Game

  1. LibGDX: Lifecylce (Render() Method)
  2. LibGDX: Delta Time
  3. LibGDX: Animation & Spritesheet
  4. LibGDX: Keyboard, Mouse & Touch Screen Control
  5. Input Control (Polling VS Event Driven Input)
  6. LibGDX: Tiled (Background and Foreground)
  7. LibGDX: Jumping Action
  8. LibGDX: Tiled (Collision Detection)
  9. LibGDX: Tiled (Bullet Class)
  10. LibGDX: Audio (Sound & Music)
  11. LibGDX: Tiled (Scrollable Background with Camera & HUD)
  12. LibGDX: WorldController & WorldRenderer Class

LibGDX/Java - Card Game No.1 - Blackjack

  1. LibGDX: Install & Setup Android Studio IDE
  2. LibGDX: Use Android Studio to Run Java Hello World
  3. LibGDX: Use Android Studio to Run LibGDX Hello World
  4. Adobe Illustrator: Basic Components Part 1
  5. Adobe Illustrator: Basic Components Part 2
  6. Adobe Illustrator: BlackJack Table & Cards
  7. LibGDX: Blackjack Animation
  8. LibGDX: Interpolation
  9. Java: toString() Method
  10. Java: Blackjack Shuffle Methods
  11. LibGDX: Blackjack Shuffle Method
  12. Java: Blackjack Card Game

LibGDX - Others

  1. Making and Displaying App Icon
  2. LibGDX: Displaying Traditional and Simplified Chinese Characters
  3. LibGDX: Handling Different Screen Resolutions

Unity Game Engine & C#

  1. Visual Studio: C# Hello World
  2. Unity: C# Hello World
  3. Unity: Handling Different Screen Resolutions
  4. Unity: Life Cycle
  5. Unity: StartCoroutine, StopCoroutine, IEnumerator & Yield
  6. Unity: Splash Screen
  7. Unity: Fonts, Traditional and Simplified Chinese Characters
  8. Unity: GameObject, Class Object, new & Instantiate
  9. Unity: Start Screen with Glowing Animated Button
  10. Unity: C# Get & Set Modifier
  11. Unity: Delegates & Events
  12. Unity: File I/O, Read & Write Text File & PlayerPrefs
  13. Unity: Game Level Selection Screen
  14. Unity: Game Menu Screen & ScreenManager
  15. Unity: Encrypt and Decrypt Text File
  16. Unity: Options Menu Screen
  17. Unity: Convert Numbers Image to Custom Font

Unity - Card Game No.1 - Blackjack

  1. Unity: Blackjack Card Game - Part 1 (Full Game)
  2. Unity: Blackjack Card Game - Part 2
  3. Unity: Blackjack Card Game - Part 3
  4. Unity: Blackjack Card Game - Part 4
  5. Unity: Blackjack Card Game - Part 5
  6. Unity: Blackjack Card Game - Part 6
  7. Unity: Blackjack Card Game - Part 7

以下是預告-Coming soon!


Secret Weapon No.1

  1. Unity: Card Game No.2

Advanced Programming

  1. Unity: GPS Programming
  2. Unity: User Login System
  3. Unity: Augmented Reality (AR)

Secret Weapon No.2

  1. Unity: GPS & AR Application

第58節 - Visual Studio: C# Hello World

前言

這一節開始,我會介紹利用Unity、 C-Sharp(C#)和Visual Studio(IDE)去寫電話遊戲程式,我會以2D遊戲為主。

Unity是一隻Game Engine軟件,相反,LibGDX是一隻Game Framework軟件,但Unity和LibGDX有一個共通點,就是大家都支援跨平台(Cross-platform),Apps(應用程式)或遊戲可以在iOS (iPhone and iPad), Android, Windows browsers (HTML),Mac或Linux上運行。

但Unity的功能更加強大,可以支援以下平台(27種以上):

Unity Viusal Studio Hello World

為甚麼我會由學習LibGDX改為學習Unity去寫遊戲程式?

其實我不是放棄學習LibGDX,而是進入下一個學習階段。

因為LibGDX是一隻Game Framework軟件,當大家開發一隻遊戲時,每一部分內容都是用程式來設定,就如第1節至第57節所介紹的內容。

但Unity是一隻Game Engine軟件,當大家開發一隻遊戲時,大部分內容只要在Unity軟件內1) Drag & Drop、2)加入功能和3)設定數值等,就可以完成一隻遊戲,當然也有必須的程式部分。

還有,就是因為Unity是一隻Game Engine軟件,有很多功能如Animation、Particle System和Physics(2D或3D)等功能都可以在Unity軟件內輕鬆設定。

但是學習Unity Game Engine之前,建議大家先學習LibGDX Game Framework軟件,就如我在第1節至第57節所介紹的內容。當大家明白開發一隻遊戲的基本概念後,就可以進入下一個階段,利用Unity Game Engine開發遊戲程式,否則大家可能只會抄襲其他人的遊戲,而沒有能力開發自己自創的遊戲。

Unity VS LibGDX

以下是Unity和LibGDX的基本特性比較:

注意1: 我會選用Unity Personal Edition (Free)和介紹Unity 2D遊戲製作。

注意2: 我會選用C#程式語言。

注意3: 我會選用Visual Studio (IDE)寫C#程式語言。

Unity Viusal Studio Hello World

Visual Studio C# Hello World

當大家安裝完最新版Unity Personal Edition (Free)後,Unity和Visual Studio已經一同安裝在你的電腦上,如下圖:

Unity Viusal Studio Hello World
  1. 首先我會介紹單純利用Visual Studio的C#語言來寫第一個人Hello World程式,所以按以上Visual Studio Icon:

Unity Viusal Studio Hello World
  1. 選擇File > New > Project...。

Unity Viusal Studio Hello World
  1. 選擇Windows。

  2. 選擇Console Application。

  3. 選擇Name,輸入HelloWorld,HelloWorld資料夾(Folder)就會自動建立,HelloWorld資料夾內就會自動建立一個Program.cs檔案(cs代表C-Sharp或C#),Program.cs檔案內就有一個人Program Class(類別)和Main Method(方法)。

  4. 選擇Location,你的電腦儲存位置。

  5. 選擇Solution name,輸入HelloWorld_Solution,HelloWorld_Solution資料夾(Folder)就會自動建立,HelloWorld_Solution資料夾就是這個Project的名稱。

  6. 按"OK"。

Unity Viusal Studio Hello World
  1. HelloWorld資料夾內就會自動建立一個Program.cs檔案(cs代表C-Sharp或C#)。

  2. HelloWorld資料夾內就會有一個人Program.cs檔案,Program.cs檔案內就會有一個Program Class(類別)和Main Method(方法)。

Unity Viusal Studio Hello World
  1. 電腦儲存HelloWorld_Solution資料夾的位置(Location)。

  2. HelloWorld_Solution資料夾。

  3. HelloWorld_Solution資料夾(Folder)內就有一個HelloWorld_Solution.sln檔案,按這個檔案就可進入Visual Studio內,(sln代表solution)。

  4. HelloWorld資料夾(Folder)內就有一個Program.cs檔案。

Unity Viusal Studio Hello World
  1. 這一行可以顯示"Hello, World!"。

  2. 這一行會令電腦進入等待輸入狀態,這樣做我們就可以輕鬆看到執行結果,否則輸出結果就只會一閃就消失。

Unity Viusal Studio Hello World
  1. 輸出"Hello, World!"。

Open Existing File

如果想開啟現有檔案,如下圖:

Unity Viusal Studio Hello World
  1. 選擇Open。

  2. 選擇Project/Solution...。

Unity Viusal Studio Hello World
  1. 選擇HelloWorld_Solution.sln 。

Unity Viusal Studio Hello World
  1. HelloWorld資料夾內就會有一個人Program.cs檔案,Program.cs檔案內就會有一個Program Class(類別)和Main Method(方法)。