game development using monogame
TRANSCRIPT
![Page 1: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/1.jpg)
Game Development using monogame
2016/12/22Power Wu
![Page 2: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/2.jpg)
環境安裝 安裝 Visual Studio 2015 Community https://go.microsoft.com/fwlink/?LinkId=691978&clcid=0x404
安裝 Monogame for Visual Studio http://www.monogame.net/2016/03/17/monogame-3-5/
![Page 3: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/3.jpg)
什麼是遊戲引擎 已經編輯好遊戲流程與遊戲架構,方便開發者快速開發遊戲的核心套件組。 常見的遊戲引擎:Unity 3DUnrealCryENGINESourceMonogameCocos
![Page 4: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/4.jpg)
遊戲流程與架構Initialize
Load Content
Update
Draw
Unload Content
1/60 Second
Exit
X
Y
![Page 5: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/5.jpg)
遊戲引擎應用 除了做遊戲,還可以用來: 設計華麗的應用程式介面 利用粒子系統做特效 做動畫 ……
![Page 6: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/6.jpg)
Monogame 簡介 使用 C# 程式語言開發(物件導向設計) .NET Framework 2D/3D 皆可開發 跨平台支援: Windows 、 Xbox 、 Windows Phone 、 iOS 、 Android 、 MacOS 、 Linux
![Page 7: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/7.jpg)
今天要做的遊戲 Flappy Bird
![Page 8: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/8.jpg)
開啟 Monogame 專案點選 New Project
在 Visual C# 中找到 Monogame
創立一個 Windows Project
![Page 9: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/9.jpg)
匯入素材
Content pipeline
![Page 10: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/10.jpg)
Content Pipeline
匯入素材
![Page 11: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/11.jpg)
Content Pipeline
素材
![Page 12: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/12.jpg)
素材
800px
480px
808px
71px
73px
88px
239px
108px
![Page 13: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/13.jpg)
字型檔案 在 Pipeline 中選取 Add New Item ,選取 SpriteFont
![Page 14: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/14.jpg)
修改字型檔參數
字型大小
預設文字只能使用英文。有機會再教大家如何使用中文字。
![Page 15: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/15.jpg)
環境設定 遊戲解析度設定為: 1200*490 在 Game 的 Constructor 中加入 graphics 設定
![Page 16: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/16.jpg)
遊戲參數 物體移動的速度 重力 按下空白鍵時飛上去的高度
![Page 17: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/17.jpg)
動態背景
800px
1200px
由於系統環境寬度是 1200 ,所以需要 3 張背景圖才能完美接軌
![Page 18: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/18.jpg)
飛機動畫 每間格 66 毫秒撥放下一張圖示,重複撥放即可實現螺旋槳動畫。
![Page 19: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/19.jpg)
隨機生成石頭
![Page 20: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/20.jpg)
判斷碰撞 兩個 rectangle 是否重疊 判斷重疊部分的 Alpha 值是否為 0 則為碰撞
![Page 21: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/21.jpg)
部屬你的遊戲 點選專案右鍵 Publish ,即可擁有安裝檔
![Page 22: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/22.jpg)
分享你的作品 有興趣可以分享你自己版本的 Flappy Bird 至討論區「實習課問題討論 」。
![Page 23: Game development using monogame](https://reader036.vdocuments.net/reader036/viewer/2022081513/58a0d33e1a28abeb378b46a9/html5/thumbnails/23.jpg)
實作 Coding