// MOVING CIRCLE
Init<-0;
ls<-0;
// Init display makes a voxel display wall using special display voxels.
function Init_Display(Size)
{
local x,y;
// Clear Zone
for (x=0;x<32;x++)
for (y=0;y<64;y++) UNF_PlaceVoxel3D(x+1,y,0,0);
// Setup the screen
for (x=0;x<Size;x++)
for (y=0;y<Size;y++) UNF_PlaceVoxel3D(x+1,y,0,223);
}
// This function is called repeatedly for each step of the robot.
function Voxel_Step()
{
local x,y,i,j;
// Startup code, build the environnment. Executes only once.
if (Init == 0)
{
Init_Display(17); // Init the display wall.
Image_New(0,16,16); // Create an image canva for drawing.
Image_SetPixel(0,1,1,1);
Init=1;
}
// Draw a circle in the image canva
Image_Clear(0,0);
Image_Circle_Filled(0,7,7,ls,1);
// Display the image canva to the voxel wall
for (x=0;x<16;x++)
for (y=0;y<16;y++)
{
i = (Image_GetPixel(0,15-x,15-y)>0) ? 0 : 7;
Voxel_SetInfo(1+x,0+y,0,1,i);
}
// Increase the circle radius for the next display step
ls++; if (ls > 7 ) ls = 0;
}