Skip to content

Instantly share code, notes, and snippets.

@Adrianl3d
Created July 9, 2014 12:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Adrianl3d/1d91dde37c730f5c7337 to your computer and use it in GitHub Desktop.
Save Adrianl3d/1d91dde37c730f5c7337 to your computer and use it in GitHub Desktop.
Builds a black and white checkered floor of 1 meter voxels.
// checkeredFloor.js
// Simple 20m x 20m floor with black and white checker pattern using 1 meter voxels.
// Scalable by changing value at "var size = " but must be an even number or the result will be stripes.
// Created by Adrian on 9 July 2014
// Copyright 2014 Adrian McCarlie
// Released under Creative Commons By Attribution Share Alike, feel free to modify and share.
// YOU MUST CHANGE these 3 values to suit the starting position (South/West corner) of the floor.
var X_POS = 200;
var Y_POS = 200;
var Z_POS = 200;
//
var size = 20; // This must be an even number.
var color = 255;
//
var x = X_POS;
var y = Y_POS;
var z = Z_POS;
function checkeredFloor ()
{
while (z < (Z_POS + size))
{
while (x < (X_POS + size-1))
{
if (color == 1)
{
color = 255;
}
else
{
color = 1;
}
Voxels.setVoxel(x, y, z, 1, color, color, color);
x++
}
x = X_POS;
z++;
}
Script.stop();
}
checkeredFloor();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment