为什么用 Ebitengine 学游戏开发

传统图形库如 SFML 或 SDL 依赖 C/C++,绑定复杂且编译成本高;而 Unity、Unreal 虽功能强大,但学习曲线陡峭,且运行环境庞大。Ebitengine 是 Go 语言的 2D 游戏引擎,它解决的核心问题是:**让开发者用熟悉的 Go 语法,快速构建可打包、跨平台运行的 2D 游戏**。它没有繁重的资源管理系统,也没有复杂的渲染管线黑盒,代码即逻辑,直观且轻量。对于想通过项目驱动掌握 Go 并发、结构体及面向对象特性的开发者而言,这是极佳的实战场景。

适合什么基础、先从哪里入手

本课程适合**已掌握 Go 基本语法**(变量、函数、结构体、接口)但缺乏大型项目经验的开发者。如果你只是“看了文档但不敢写长代码”,或者希望将 Go 技能从脚本层推向图形交互层,这门课是合适的跳板。不需要预先具备图形学或数学背景,因为 Ebitengine 抽象了底层绘图细节。

建议学习顺序如下:
- **前置准备**:确保本地已安装 Go 1.20+ 环境,并熟悉 `go mod` 包管理。
- **第一阶段:渲染与窗口管理**:先看懂如何创建窗口、处理用户输入(键盘/鼠标),并理解 Ebitengine 的“更新-绘制”循环机制。这是所有游戏引擎的通用范式。
- **第二阶段:精灵与动画**:学习如何加载图片资源(Sprite)、控制帧动画、处理图层叠加。这部分能帮你理解 2D 游戏的基本视觉构成。
- **第三阶段:物理与碰撞**:掌握简单的 AABB 碰撞检测、重力模拟和速度控制。这是实现可玩性的关键。
- **第四阶段:完整游戏构建**:将前面知识点整合,完成一个可运行的完整小游戏(如打砖块、飞船射击或平台跳跃),并学习打包为 EXE 或可执行文件。

学完能独立做什么、资料如何配合

学完本课程后,你能够**独立开发并打包发布跨平台 2D 小游戏**,包括控制台交互、图形渲染、音效播放和资源管理。你将不再依赖重型引擎,而是能用纯 Go 代码快速实现原型验证或小型娱乐应用。同时,你对 Go 的面向对象设计、事件驱动架构和性能优化会有更深刻的理解。

配套资料通常包含示例代码、资源文件和课程注释。建议你**边看边敲代码**,不要只看不练。每个模块完成后,尝试修改参数(如速度、颜色、碰撞体积),观察效果变化,这是巩固知识的最佳方式。如果遇到报错,优先查阅 Ebitengine 官方文档和社区案例,培养独立调试能力。最终目标是将所学知识迁移到个人项目中,哪怕是一个简单的待办事项动画工具,也能让你真正掌握这门技术。

Building 2D Games with Ebitengine in Go (Golang)

本课程隶属 会员库 · 其他机构课程,完整课程目录与配套资料如下。

课程目录

1 - Introduction/
1 -Introduction.en_US.vtt
1 -Introduction.mp4
1 -Introduction.srt
1 -Introduction_en.srt
2 -A bit about me.en_US.vtt
2 -A bit about me.mp4
2 -A bit about me.srt
2 -A bit about me_en.srt
3 -Installing Go.en_US.vtt
3 -Installing Go.mp4
3 -Installing Go.srt
3 -Installing Go_en.srt
4 -Installing Visual Studio Code.en_US.vtt
4 -Installing Visual Studio Code.mp4
4 -Installing Visual Studio Code.srt
4 -Installing Visual Studio Code_en.srt
5 -Ensuring our development environment is ready for Ebiten.en_US.vtt
5 -Ensuring our development environment is ready for Ebiten.mp4
5 -Ensuring our development environment is ready for Ebiten.srt
5 -Ensuring our development environment is ready for Ebiten_en.srt
6 -Asking for help.en_US.vtt
6 -Asking for help.mp4
6 -Asking for help.srt
6 -Asking for help_en.srt
10 - Adding Simple Game Physics/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Setting up basic inertia.en_US.vtt
2 -Setting up basic inertia.mp4
2 -Setting up basic inertia.srt
2 -Setting up basic inertia_en.srt
2 -go-asteroids.zip
11 - Adding Aliens/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Setting up the Alien Type.en_US.vtt
2 -Setting up the Alien Type.mp4
2 -Setting up the Alien Type.srt
2 -Setting up the Alien Type_en.srt
2 -go-asteroids.zip
3 -Setting up the AlienLaser Type.en_US.vtt
3 -Setting up the AlienLaser Type.mp4
3 -Setting up the AlienLaser Type.srt
3 -Setting up the AlienLaser Type_en.srt
3 -go-asteroids.zip
4 -Updating the GameScene to spawn aliens.en_US.vtt
4 -Updating the GameScene to spawn aliens.mp4
4 -Updating the GameScene to spawn aliens.srt
4 -Updating the GameScene to spawn aliens_en.srt
4 -go-asteroids.zip
5 -Allowing the aliens to fire lasers.en_US.vtt
5 -Allowing the aliens to fire lasers.mp4
5 -Allowing the aliens to fire lasers.srt
5 -Allowing the aliens to fire lasers_en.srt
5 -go-asteroids.zip
6 -Handling collisions between Aliens, Alien Lasers and the Player.en_US.vtt
6 -Handling collisions between Aliens, Alien Lasers and the Player.mp4
6 -Handling collisions between Aliens, Alien Lasers and the Player.srt
6 -Handling collisions between Aliens, Alien Lasers and the Player_en.srt
6 -go-asteroids.zip
12 - Deploying the application/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Appify.url
2 -Building an executable with a custom icon for a Mac.en_US.vtt
2 -Building an executable with a custom icon for a Mac.mp4
2 -Building an executable with a custom icon for a Mac.srt
2 -Building an executable with a custom icon for a Mac_en.srt
2 -Taskfile.url
2 -Taskfile.yml
3 -Building an executable with a custom icon for Windows.en_US.vtt
3 -Building an executable with a custom icon for Windows.mp4
3 -Building an executable with a custom icon for Windows.srt
3 -Building an executable with a custom icon for Windows_en.srt
3 -go-winres.url
3 -icons.zip
4 -Deploying our game to the web as a WASM file.en_US.vtt
4 -Deploying our game to the web as a WASM file.mp4
4 -Deploying our game to the web as a WASM file.srt
4 -Deploying our game to the web as a WASM file_en.srt
4 -go-asteroids.zip
2 - Getting Started With Our Game/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Important note for Windows WSL users.en_US.vtt
2 -Important note for Windows WSL users.mp4
2 -Important note for Windows WSL users.srt
2 -Important note for Windows WSL users_en.srt
3 -Getting started with our game.en_US.vtt
3 -Getting started with our game.mp4
3 -Getting started with our game.srt
3 -Getting started with our game_en.srt
3 -go-asteroids.zip
4 -Getting started with sprites.en_US.vtt
4 -Getting started with sprites.mp4
4 -Getting started with sprites.srt
4 -Getting started with sprites_en.srt
4 -assets.zip
4 -go-asteroids.zip
5 -Creating a Player object with our sprite.en_US.vtt
5 -Creating a Player object with our sprite.mp4
5 -Creating a Player object with our sprite.srt
5 -Creating a Player object with our sprite_en.srt
5 -go-asteroids.zip
6 -Drawing the player to the screen.en_US.vtt
6 -Drawing the player to the screen.mp4
6 -Drawing the player to the screen.srt
6 -Drawing the player to the screen_en.srt
6 -go-asteroids.zip
7 -Rotating the player sprite.en_US.vtt
7 -Rotating the player sprite.mp4
7 -Rotating the player sprite.srt
7 -Rotating the player sprite_en.srt
7 -go-asteroids.zip
8 -Moving the player on the screen.en_US.vtt
8 -Moving the player on the screen.mp4
8 -Moving the player on the screen.srt
8 -Moving the player on the screen_en.srt
8 -go-asteroids.zip
9 -Keeping the player on the screen.en_US.vtt
9 -Keeping the player on the screen.mp4
9 -Keeping the player on the screen.srt
9 -Keeping the player on the screen_en.srt
9 -go-asteroids.zip
3 - Setting Up Scenes/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Building a scene manager.en_US.vtt
2 -Building a scene manager.mp4
2 -Building a scene manager.srt
2 -Building a scene manager_en.srt
2 -go-asteroids.zip
3 -Modifying the Game type to use a scene manager.en_US.vtt
3 -Modifying the Game type to use a scene manager.mp4
3 -Modifying the Game type to use a scene manager.srt
3 -Modifying the Game type to use a scene manager_en.srt
3 -go-asteroids.zip
4 -Setting up a Game Scene.en_US.vtt
4 -Setting up a Game Scene.mp4
4 -Setting up a Game Scene.srt
4 -Setting up a Game Scene_en.srt
4 -go-asteroids.zip
5 -Updating the Player type to use a scene manager.en_US.vtt
5 -Updating the Player type to use a scene manager.mp4
5 -Updating the Player type to use a scene manager.srt
5 -Updating the Player type to use a scene manager_en.srt
5 -go-asteroids.zip
6 -Trying out our updated project.en_US.vtt
6 -Trying out our updated project.mp4
6 -Trying out our updated project.srt
6 -Trying out our updated project_en.srt
7 -Adding a simple title scene.en_US.vtt
7 -Adding a simple title scene.mp4
7 -Adding a simple title scene.srt
7 -Adding a simple title scene_en.srt
7 -go-asteroids.zip
8 -Updating text display to use textv2.en_US.vtt
8 -Updating text display to use textv2.mp4
8 -Updating text display to use textv2.srt
8 -Updating text display to use textv2_en.srt
8 -go-asteroids.zip
4 - Adding Meteors to our Game/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Loading meteor assets.en_US.vtt
2 -Loading meteor assets.mp4
2 -Loading meteor assets.srt
2 -Loading meteor assets_en.srt
2 -go-asteroids.zip
3 -Getting started with meteor.go.en_US.vtt
3 -Getting started with meteor.go.mp4
3 -Getting started with meteor.go.srt
3 -Getting started with meteor.go_en.srt
3 -go-asteroids.zip
4 -Adding the Update, Draw, and keepOnScreen methods to our Meteor type.en_US.vtt
4 -Adding the Update, Draw, and keepOnScreen methods to our Meteor type.mp4
4 -Adding the Update, Draw, and keepOnScreen methods to our Meteor type.srt
4 -Adding the Update, Draw, and keepOnScreen methods to our Meteor type_en.srt
4 -go-asteroids.zip
5 -Draw some meteors on the TitleScene.en_US.vtt
5 -Draw some meteors on the TitleScene.mp4
5 -Draw some meteors on the TitleScene.srt
5 -Draw some meteors on the TitleScene_en.srt
5 -go-asteroids.zip
6 -Drawing meteors on the GameScene.en_US.vtt
6 -Drawing meteors on the GameScene.mp4
6 -Drawing meteors on the GameScene.srt
6 -Drawing meteors on the GameScene_en.srt
6 -go-asteroids.zip
5 - Collision detection/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Add solarluneresolv to our project to allow for collision detection.en_US.vtt
2 -Add solarluneresolv to our project to allow for collision detection.mp4
2 -Add solarluneresolv to our project to allow for collision detection.srt
2 -Add solarluneresolv to our project to allow for collision detection_en.srt
2 -go-asteroids.zip
2 -resolv on github.url
3 -Updating meteors to create collision objects.en_US.vtt
3 -Updating meteors to create collision objects.mp4
3 -Updating meteors to create collision objects.srt
3 -Updating meteors to create collision objects_en.srt
3 -go-asteroids.zip
4 -Updating the player to create collision object.en_US.vtt
4 -Updating the player to create collision object.mp4
4 -Updating the player to create collision object.srt
4 -Updating the player to create collision object_en.srt
4 -go-asteroids.zip
5 -Creating a space for collisions in the Game Scene.en_US.vtt
5 -Creating a space for collisions in the Game Scene.mp4
5 -Creating a space for collisions in the Game Scene.srt
5 -Creating a space for collisions in the Game Scene_en.srt
5 -go-asteroids.zip
6 -Testing collision detection.en_US.vtt
6 -Testing collision detection.mp4
6 -Testing collision detection.srt
6 -Testing collision detection_en.srt
6 -go-asteroids.zip
6 - Implementing Basic Gameplay/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Getting started adding player lasers.en_US.vtt
2 -Getting started adding player lasers.mp4
2 -Getting started adding player lasers.srt
2 -Getting started adding player lasers_en.srt
2 -go-asteroids.zip
3 -Adding lasers to the Player and Game Scene.en_US.vtt
3 -Adding lasers to the Player and Game Scene.mp4
3 -Adding lasers to the Player and Game Scene.srt
3 -Adding lasers to the Player and Game Scene_en.srt
3 -go-asteroids.zip
4 -Actually firing lasers.en_US.vtt
4 -Actually firing lasers.mp4
4 -Actually firing lasers.srt
4 -Actually firing lasers_en.srt
4 -go-asteroids.zip
5 -Destroying meteors with lasers.en_US.vtt
5 -Destroying meteors with lasers.mp4
5 -Destroying meteors with lasers.srt
5 -Destroying meteors with lasers_en.srt
5 -go-asteroids.zip
6 -Destroying meteors with lasers II.en_US.vtt
6 -Destroying meteors with lasers II.mp4
6 -Destroying meteors with lasers II.srt
6 -Destroying meteors with lasers II_en.srt
6 -go-asteroids.zip
7 -Destroying the player with meteors.en_US.vtt
7 -Destroying the player with meteors.mp4
7 -Destroying the player with meteors.srt
7 -Destroying the player with meteors_en.srt
7 -go-asteroids.zip
7 - Adding Sound/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
10 -Adding background stars to the Game Scene.en_US.vtt
10 -Adding background stars to the Game Scene.mp4
10 -Adding background stars to the Game Scene.srt
10 -Adding background stars to the Game Scene_en.srt
10 -go-asteroids.zip
2 -Loading acceleration sound asset.en_US.vtt
2 -Loading acceleration sound asset.mp4
2 -Loading acceleration sound asset.srt
2 -Loading acceleration sound asset_en.srt
2 -go-asteroids.zip
3 -Adding acceleration sound.en_US.vtt
3 -Adding acceleration sound.mp4
3 -Adding acceleration sound.srt
3 -Adding acceleration sound_en.srt
3 -go-asteroids.zip
4 -Adding exhaust while accelerating.en_US.vtt
4 -Adding exhaust while accelerating.mp4
4 -Adding exhaust while accelerating.srt
4 -Adding exhaust while accelerating_en.srt
4 -go-asteroids.zip
5 -Allowing the player to move backwards.en_US.vtt
5 -Allowing the player to move backwards.mp4
5 -Allowing the player to move backwards.srt
5 -Allowing the player to move backwards_en.srt
5 -go-asteroids.zip
6 -Adding laser sounds.en_US.vtt
6 -Adding laser sounds.mp4
6 -Adding laser sounds.srt
6 -Adding laser sounds_en.srt
6 -Original asteroids sounds.url
6 -go-asteroids.zip
7 -Adding explosion sounds.en_US.vtt
7 -Adding explosion sounds.mp4
7 -Adding explosion sounds.srt
7 -Adding explosion sounds_en.srt
7 -go-asteroids.zip
8 -Adding background sounds.en_US.vtt
8 -Adding background sounds.mp4
8 -Adding background sounds.srt
8 -Adding background sounds_en.srt
8 -go-asteroids.zip
9 -Adding background stars.en_US.vtt
9 -Adding background stars.mp4
9 -Adding background stars.srt
9 -Adding background stars_en.srt
9 -go-asteroids.zip
8 - Adding Levels/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Adding a Game Over Scene.en_US.vtt
2 -Adding a Game Over Scene.mp4
2 -Adding a Game Over Scene.srt
2 -Adding a Game Over Scene_en.srt
2 -go-asteroids.zip
3 -Adding Lives Remaining indicators.en_US.vtt
3 -Adding Lives Remaining indicators.mp4
3 -Adding Lives Remaining indicators.srt
3 -Adding Lives Remaining indicators_en.srt
3 -go-asteroids.zip
4 -Adding Lives Remaining indicators II.en_US.vtt
4 -Adding Lives Remaining indicators II.mp4
4 -Adding Lives Remaining indicators II.srt
4 -Adding Lives Remaining indicators II_en.srt
4 -go-asteroids.zip
5 -Displaying the current score, high score, and level.en_US.vtt
5 -Displaying the current score, high score, and level.mp4
5 -Displaying the current score, high score, and level.srt
5 -Displaying the current score, high score, and level_en.srt
5 -go-asteroids.zip
6 -Persisting the high score.en_US.vtt
6 -Persisting the high score.mp4
6 -Persisting the high score.srt
6 -Persisting the high score_en.srt
6 -go-asteroids.zip
7 -Moving to the next level.en_US.vtt
7 -Moving to the next level.mp4
7 -Moving to the next level.srt
7 -Moving to the next level_en.srt
7 -go-asteroids.zip
9 - Adding Shields and Hyperspace/
1 -What we'll build in this section.en_US.vtt
1 -What we'll build in this section.mp4
1 -What we'll build in this section.srt
1 -What we'll build in this section_en.srt
2 -Setting up the Shield assets, type, and drawing the shield.en_US.vtt
2 -Setting up the Shield assets, type, and drawing the shield.mp4
2 -Setting up the Shield assets, type, and drawing the shield.srt
2 -Setting up the Shield assets, type, and drawing the shield_en.srt
2 -go-asteroids.zip
3 -Displaying and updating the shield.en_US.vtt
3 -Displaying and updating the shield.mp4
3 -Displaying and updating the shield.srt
3 -Displaying and updating the shield_en.srt
3 -go-asteroids.zip
4 -Setting up Shield Indicators.en_US.vtt
4 -Setting up Shield Indicators.mp4
4 -Setting up Shield Indicators.srt
4 -Setting up Shield Indicators_en.srt
4 -go-asteroids.zip
5 -Bouncing meteors off of the shield.en_US.vtt
5 -Bouncing meteors off of the shield.mp4
5 -Bouncing meteors off of the shield.srt
5 -Bouncing meteors off of the shield_en.srt
5 -go-asteroids.zip
6 -Setting up Hyperspace and the Hyperspace indicator.en_US.vtt
6 -Setting up Hyperspace and the Hyperspace indicator.mp4
6 -Setting up Hyperspace and the Hyperspace indicator.srt
6 -Setting up Hyperspace and the Hyperspace indicator_en.srt
6 -go-asteroids.zip
获取更多精品课程资源.url