Skip to content

Instantly share code, notes, and snippets.

@mk30
Created January 21, 2015 19:19
Show Gist options
  • Select an option

  • Save mk30/4cdd4d50b758bc4a4d71 to your computer and use it in GitHub Desktop.

Select an option

Save mk30/4cdd4d50b758bc4a4d71 to your computer and use it in GitHub Desktop.
voxel
var createGame = require('voxel-hello-world')
var game = createGame({
generate: function(x, y, z) {
return y === 1 ? 1 : 0
},
materials: [['grass', 'dirt', 'grass_dirt'], 'brick', 'dirt',
'gold_ore', 'hardened_clay_stained_cyan', ],
})
window.game = game
var snow = require('voxel-snow')({
game: game,
count: 2000,
size: 20
});
var critterCreator = require('voxel-critter')(game)
critterCreator('./snowman.png', function(err, critter) {
// Move forward
critter.move(0, 0, 0.02);
// Jump!
critter.jump();
});
game.on('tick', function() {
snow.tick();
});
@shama
Copy link
Copy Markdown

shama commented Jan 21, 2015

Try this:

var critterCreator = require('voxel-critter')(game)
critterCreator('./snowman.png', function(err, critter) {
  // Start the critter near the player
  critter.position.clone(game.controls.target().avatar.position);
  critter.position.z += 10;
  critter.position.y += 10;

  // Move forward
  critter.move(0, 0, 0.02);

  // Jump!
  critter.jump();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment