作者cnoize (泥巴星球Server)
看板GameDesign
标题[程式] 四小时学会建置简易PC/Web/Android游戏
时间Thu Jul 25 11:54:24 2019
ebiten 套件原作者是日本人。
少量游戏作品可在 wiki 中找到:
https://github.com/hajimehoshi/ebiten/wiki/Works
很多使用范例可以学习:
https://github.com/hajimehoshi/ebiten/tree/master/examples
0.
前人写的中文教学:
https://yami.io/tag/ebiten/
在 Golang 透过 Ebiten(炸虾)来制作 8-Bit 游戏!
1.
安装 git
https://gitforwindows.org/
2.
安装 GO
https://golang.org/
3.
安装 Android Studio
https://developer.android.com/studio
我是装在 c:\and
装好後 Configure -> SDK -> SDK tools
找到 NDK 勾选它, 选 apply
SDK 我是装在 c:\andsdk
NDK 在 c:\andsdk\ndk-bundle
set ANDROID_NDK_HOME=c:\andsdk\ndk-bundle
或原始目录
set ANDROID_NDK_HOME= \
C:\Users\username\AppData\Local\Android\Sdk\ndk-bundle
4.
安装 gomobile
https://godoc.org/golang.org/x/mobile/cmd/gomobile
go get golang.org/x/mobile/cmd/gomobile
gomobile init
5.
依照上面的中文说明取得 ebiten
set ANDROID_NDK_HOME=c:\andsdk\ndk-bundle
gomobile build -tags=example \
-target=android github.com/hajimehoshi/ebiten/examples/2048
得到 go2048.apk
安装雷电可使用:
https://imgur.com/QbC1uhd
https://github.com/hajimehoshi/ebiten/wiki/Android
https://github.com/hajimehoshi/ebiten/wiki/iOS
https://github.com/hajimehoshi/ebiten/wiki/Mobile
6.
WWW
https://github.com/hajimehoshi/ebiten/wiki/GopherJS
go get github.com/gopherjs/gopherjs
gopherjs 不能用 -tags=example,原作者有设定 example 和系统分开
所以要 copy
cd work
xcopy /s C:\Users\username\go\src\github.com\hajimehoshi\ebiten\examples\2048
set GOOS=linux
gopherjs build -o 2048.js main.go
notepad 2048.htm
<!DOCTYPE html>
<script src="2048.js"></script>
https://www.rejetto.com/hfs/
hfs.exe 2048.htm 2048.js
hfs 会有网址
可用 chrome 开启:
https://imgur.com/w5for3v
7.
PC 原版
go run -tags=example github.com/hajimehoshi/ebiten/examples/2048
https://imgur.com/zhfWiL4
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 220.129.22.24 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/GameDesign/M.1564026870.A.1F8.html
1F:推 wangm4a1: 推 07/25 13:12
2F:推 lanpadick: push 07/25 18:32
3F:推 justatree: 推 07/25 20:17
4F:推 aton602: 推 07/25 21:42
5F:推 NX9999: 感谢,来试试看XD 07/26 01:56