max-mapper / voxel-engine

3D HTML5 voxel game engine
http://maxogden.github.com/voxel-engine
BSD 3-Clause "New" or "Revised" License
1.29k stars 220 forks source link

Keybindings #113

Closed z3t0 closed 9 years ago

z3t0 commented 9 years ago

How would I make a keybinding for if the right mouse button is pressed the following happens.

position = block;
    console.log("Position: " + position);
    var blockType = game.getBlock(position);
    console.log("Checked: " + blockType);

I can get it working with the left button only.

game.on('fire', function (pos){
    position = block;
    console.log("Position: " + position);
    var blockType = game.getBlock(position);
    console.log("Checked: " + blockType);
})
z3t0 commented 9 years ago

Answers here https://github.com/maxogden/voxel-engine/issues/114