把别人的Tcl/Tk代码加入到Go语言里14 游戏7 行星游戏
时间:2015-05-13 14:58:52
收藏:0
阅读:161
a 首先打开网页 http://wiki.tcl.tk/13601
b 把网页里提到的第一段tcl/tk代码复制到如下go源代码的init_script字符串常量里
package main
import "github.com/nsf/gothic"
const init_script = `
#把Tcl/Tk源代码复制到这个常量里
`
func main() {
ir := gothic.NewInterpreter(init_script)
<-ir.Done
}
c 在LiteIDE里或命令行里go run go代码文件,运行效果如下
小飞机的控制:
Left Arrow - rotate CCW
Right Arrow - rotate CW
Up Arrow - Thrust
Space空格 - Fire射击
Down Arrow - Hyperspace 随机瞬移(moves ship to a random screen coordinate)
评论(0)