把别人的Tcl/Tk代码加入到Go语言里14 游戏7 行星游戏

a 首先打开网页 http://wiki.tcl.tk/13601git

b 把网页里提到的第一段tcl/tk代码复制到以下go源代码的init_script字符串常量里github

package maindom

import "github.com/nsf/gothic"
spa

const init_script = `命令行

#把Tcl/Tk源代码复制到这个常量里
ip

`字符串

func main() {it

    ir := gothic.NewInterpreter(init_script)import

    <-ir.Donerust

}

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)

相关文章
相关标签/搜索