Skip to content

Instantly share code, notes, and snippets.

@max-mapper
Last active March 6, 2021 12:17
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save max-mapper/4629616 to your computer and use it in GitHub Desktop.
Save max-mapper/4629616 to your computer and use it in GitHub Desktop.
voxel script gun scripts
for (var i = 0; i < 50; i++) {
var forward = new game.THREE.Vector3(0,0, -game.cubeSize * i)
var block = position.clone().addSelf(forward)
game.createBlock(block, 1)
}
var left = position.clone().addSelf(new game.THREE.Vector3(-game.cubeSize,0,0))
var top = position.clone().addSelf(new game.THREE.Vector3(0,game.cubeSize,0))
var right = position.clone().addSelf(new game.THREE.Vector3(0,0,game.cubeSize))
game.createBlock(left, 1)
game.createBlock(top, 1)
game.createBlock(right, 1)
@codedread
Copy link

// If right-click, create a block.  Else, delete a block
var mouseEvent = arguments[1];
if (mouseEvent.button == 2) {
  game.createBlock(position, 1);
} else {
  game.setBlock(position, 0);
}

@dibu28
Copy link

dibu28 commented Feb 13, 2014

// plane 10x10
for (var i = 0; i < 10; i++) {
for (var j = 0; j < 10; j++) {
var forward = new game.THREE.Vector3(-game.cubeSize * j, 0, -game.cubeSize * i)
var block = position.clone().addSelf(forward)
game.createBlock(block, 1)
}
}

@dibu28
Copy link

dibu28 commented Feb 13, 2014

// wall 10x10
for (var i = 0; i < 10; i++) {
for (var j = 0; j < 10; j++) {
var forward = new game.THREE.Vector3(0, game.cubeSize * j, -game.cubeSize * i)
var block = position.clone().addSelf(forward)
game.createBlock(block, 1)
}
}

@lflfm
Copy link

lflfm commented Jun 23, 2017

// Left-click to create a random block. right-click to delete a block - based on codedread's comment
var mouseEvent = arguments[1];
var blocktype = (Math.floor(Math.random() * 10) % 3)+1;
if (mouseEvent.button == 2) {
game.setBlock(position, 0);
} else {
game.createBlock(position, blocktype);
}

@pinkleafbesthepro
Copy link

How

@pinkleafbesthepro
Copy link

Idk how to make

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