8

[Golang] Online Snake Game by GopherJS

 2 years ago
source link: http://siongui.github.io/2016/01/13/go-online-snake-game-by-gopherjs/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

[Golang] Online Snake Game by GopherJS

[Golang] Online Snake Game by GopherJS

January 13, 2016

Demo (Fork me on Github)

In GopherJS DOM Example series, we show a lot of examples of DOM manipulation by GopherJS and its DOM binding. Now we will use what we learn to write a simple snake game. I wrote an online snake game in Dart (see [5]) before. This Golang snake game is ported from the Dart version. The DOM APIs provided by GopherJS and its DOM bindings are basically the same as JavaScript DOM APIs, except it is re-written in idiomatic Go. This is a good exercise to make you familiar with DOM manipulation in Go programming language.

Source Code for Demo (HTML):

Source Code for Demo (CSS):

Source Code for Demo (Go):


Tested on: Ubuntu Linux 15.10, Go 1.5.2.


Author

: Siong-Ui Te Category: GopherJS


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK