voxel-mine
v1.0.0
Published
mine blocks with damage overlay and variable hardness (voxel.js plugin)
Downloads
12
Readme
voxel-mine
An addon for voxel.js to mine blocks of variable hardness. Hold down the left mouse button to mine:
Hardness can be set for each block type (controls how long it takes to mine). As the mining progresses, damage overlay textures (not included, example is from ProgrammerArt) are shown:
The 'break' event is sent when the mining completes. You can listen to this event
and setBlock
to 0 to remove the block, or use
voxel-harvest to do this for you and
add an item representing the block to a (player's) inventory, therefore "harvesting"
the mined block. voxel-mine doesn't harvest the blocks automatically, it merely sends
an event when the mining process is complete, to be handled appropriately by other code.
Usage
var createMine = require('voxel-mine');
var mine = createMine(game, opts);
mine.on('break', function(target) {
// do something to this voxel (remove it, etc.)
});
or with voxel-plugins:
plugins.load('mine', opts);
see source for supported/required options
Requires voxel-reach
License
MIT