要不要试试做红白机游戏?#1

# 起步工作
1. 新建目录
2. VSCode 打开目录
3. github 下载 NESFab 的编译器
4. 把 nesfab.exe 复制到项目根目录 [^1]
5. 安装 NESFab 的 VSCode 语法高亮插件
6. 创建 game.cfg 的配置文件
```cfg
mapper = NROM
output = game.nes
input = lib/nes.fab
input = game.fab
```
7.
# 精灵图的创建
创建一个 128px X 256px 的 png 文件
Aseprite 软件(此软件是收费的)
https://www.aseprite.org
你也可以使用其他图片编辑软件来编辑你的精灵图,比如 PhotoShop,只要能导出 PNG 就行。
# 代码的编写
```nesfab
mode main()
palette = example_palette
ppu_upload_palette()
while true
chrrom
file(fmt, "foobar.png")
```
## 编译程序
在你的项目根目录执行 `.\nesfab.exe .\game.cfg`
# 使用 Mesen 模拟器预览
https://www.mesen.ca/
打开模拟器,将你的 game.nes 拖进去执行
在菜单栏的 Debug -> Tile View 中可以看到你的图片
[^1]: 你可以添加 nesfab.exe 的路径到你的系统环境变量,这样你就能在任何地方执行此命令。