voxel安装

http://voxeljs.com/#what

DEMO:  https://github.com/maxogden/voxel-hello-world

1.安装node.js https://nodejs.org/zh-cn/download/

2.安装voxel 

官方例子

要使用voxel.js模块,您需要安装node.js(也将安装npm)并能够使用您的计算机的命令行。

安装node.js后,可以在项目目录中安装基本的voxel.js npm软件包,然后安装基本纹理包。package.json在项目目录中创建一个调用的文件,并为其提供以下内容:

      
{
  "name": "mygamename",
  "version": "0.0.1",
  "dependencies": {
    "voxel-hello-world": "0.6.0"
  }
}
    

现在您可以告诉节点安装依赖项:

      
$ npm install

接下来,创建mygame.js并将以下代码放入其中:

      
var createGame = require('voxel-hello-world')
var game = createGame()
    

然后使用browserify构建游戏

      
$ npm install browserify -g
$ browserify mygame.js -o builtgame.js

将builtgame.js加载到网页中:

<!doctype html>
<html>
  <body>
    <script src="builtgame.js"></script>
  </body>
</html>

现在,您应该可以通过在浏览器中打开index.html来玩游戏了。

原文地址:https://www.cnblogs.com/shuangxinye/p/9487366.html