hey everyone, I got bored and decided to make a little something with this 
You get a cube, you can rotate it with swipes, press a single time on the screen, and the face which has the most ‘visible area’ on the 2D screen, will get ‘loaded’, some of the faces contain more shapes
There’s a text parameter which you need to type something in, and then press the ‘check’ button, if you have the right answer, the output will tell you
I didn’t have an aweful lot of time, so returning to the cube view while viewing a face, is also done with a parameter
It’s just a little thing, it’s my first 3D experience and I’d really like to thank @loopspace and @ignatz for making this something that’s fairly easy to understand, even if you haven’t done 3D before 
function setup()
startShapes()
CUBE = 0
GREEN = 1
YELLOW = 2
CYAN = 3
BLUE = 4
RED = 5
MAGENTA = 6
state = CUBE
timer = false
RGB = ''
pos = {x = 0, y = 0}
statepos = {x = 0, y = 0}
parameter.integer('state', 0, 6, 0)
parameter.action('Back to cube', function() state = CUBE end)
parameter.text('RGB', '')
parameter.action('check answer', check)
tt = false
time = 0
end
function draw()
pushMatrix()
background(127, 127, 127, 255)
perspective(45)
camera(0,0,400,0,0,0, 0,1,0)
if state == CUBE then
rotate(pos.x, 1, 0, 0) rotate(pos.y, 0, 1, 0)
test:draw()
test2:draw()
test3:draw()
else
if state == GREEN then
rotate(45, 1, 0, 0)
test2:draw()
test:draw()
time = time + 1
if time%60 == 0 and time <= 600 then
tt = not(tt)
end
if time >= 1000 then
time = 0
end
if tt then
testShape2:draw()
else
testShape:draw()
end
end
if state == YELLOW then
rotate(270, 1, 0, 0)
test2:draw()
end
if state == CYAN then
test:draw()
rotate(statepos.x, 1, 0, 0) rotate(statepos.y, 0, 1, 0)
end
if state == BLUE then
rotate(270, 0, 1, 0) rotate(45, 0, 0, 1)
test3:draw()
test2:draw()
jewel:draw()
minus:draw()
cyl:draw()
end
if state == RED then
rotate(180, 0, 1, 0)
test:draw()
rotate(statepos.x, 1, 0, 0) rotate(statepos.y, 0, 1, 0)
for i = 0, #jewels do
jewels[i]:draw()
end
end
if state == MAGENTA then
rotate(90, 0, 1, 0)
test3:draw()
rotate(statepos.x, 1, 0, 0) rotate(statepos.y, 0, 1, 0)
end
end
popMatrix()
end
function touched(t)
if state == CUBE then
if math.abs(t.deltaY) > 5 then pos.x = pos.x - t.deltaY/3 reset() end
if math.abs(t.deltaX) > 5 then pos.y = pos.y + t.deltaX/3 reset() end
if pos.x >= 360 then pos.x = pos.x - 360 end
if pos.x < 0 then pos.x = pos.x + 360 end
if pos.y >= 360 then pos.y = pos.y - 360 end
if pos.y < 0 then pos.y = pos.y + 360 end
if t.state == BEGAN then
timer = true
end
if t.state == ENDED and timer then
reset()
start()
end
else
if math.abs(t.deltaY) > 5 then statepos.x = statepos.x - t.deltaY/3 reset() end
if math.abs(t.deltaX) > 5 then statepos.y = statepos.y + t.deltaX/3 reset() end
end
end
function reset()
timer = false
end
function start()
if pos.x > 45 and pos.x < 135 then
state = GREEN
elseif pos.x > 225 and pos.x < 315 then
state = YELLOW
else
if pos.y > 45 and pos.y < 135 then
if pos.x > 135 and pos.x < 225 then
state = BLUE
else
state = MAGENTA
end
elseif pos.y > 315 or pos.y < 45 then
if pos.x > 135 and pos.x < 225 then
state = RED
else
state = CYAN
end
elseif pos.y < 315 and pos.y > 225 then
if pos.x > 135 and pos.x < 225 then
state = MAGENTA
else
state = BLUE
end
else
if pos.x > 135 and pos.x < 225 then
state = CYAN
else
state = RED
end
end
end
end
function startShapes()
-- yellow, jewels
jewels = {}
jewels[0] = addJewel{size = 20, color = color(255, 0, 0, 255), origin = vec3(100,0,0), light = light, ambience = 0.75}
jewels[1] = addJewel{size = 20, color = color(255, 255, 0, 255), origin = vec3(-100,0,0), light = light, ambience = 0.75}
jewels[2] = addJewel{size = 20, color = color(255, 0, 255, 255), origin = vec3(0,100,0), light = light, ambience = 0.75}
jewels[3] = addJewel{size = 20, color = color(0, 255, 0, 255), origin = vec3(0,-100,0), light = light, ambience = 0.75}
jewels[4] = addJewel{size = 20, color = color(0, 255, 255, 255), origin = vec3(0,0,100), light = light, ambience = 0.75}
jewels[5] = addJewel{size = 20, color = color(0, 0, 255, 255), origin = vec3(0,0,-100), light = light, ambience = 0.75}
--green, tests
testShape = addCylinder{center = vec3(0,50,0), height = 20, radius = 30, color = color(255, 113, 0, 255), light = light, ambient = 0,8, faceted = false, size = 20}
testShape2 = addCylinder{center = vec3(0,45,0), height = 20, radius = 30, color = color(255, 113, 0, 255), light = light, ambient = 0,8, faceted = false, size = 20}
-- blue, sum/...
jewel = addJewel{size = 10, axis = vec3(1,0,0), color = color(255, 0, 0, 255), origin = vec3(60,0,30), light = light, ambience = 0.75}
minus = addBlock{center = vec3(60,0,0), width = 5, height = 5, depth = 20, color = color(255, 255, 255, 255), light = light, ambience = 0.9}
cyl = addCylinder{center = vec3(50,0,-30), height = 20, radius = 10, color = color(0, 255, 0, 255), light = light, ambient = 0,8, faceted = false, size = 20, axis = vec3(1,0,0)}
--cube
local colors = {
color(255, 0, 0, 255),
color(255, 0, 0, 255),
color(255, 0, 0, 255),
color(255, 0, 0, 255),
color(0, 255, 255, 255),
color(0, 255, 255, 255),
color(0, 255, 255, 255),
color(0, 255, 255, 255)
}
local BFaces = {
{1,2,3,4},
{5,7,6,8},
{1,1,1,1},
{1,1,1,1},
{1,1,1,1},
{1,1,1,1}
}
test = addBlock{center = vec3(0,0,0), size = 100, color = colors, faces = BFaces}
local colors = {
color(255, 255, 0, 255),
color(255, 255, 0, 255),
color(0, 255, 0, 255),
color(0, 255, 0, 255),
color(255, 255, 0, 255),
color(255, 255, 0, 255),
color(0, 255, 0, 255),
color(0, 255, 0, 255)
}
local BFaces = {
{1,1,1,1},
{1,1,1,1},
{1,5,2,6},
{3,4,7,8},
{1,1,1,1},
{1,1,1,1}
}
test2 = addBlock{center = vec3(0,0,0), size = 100, color = colors, faces = BFaces}
local colors = {
color(255, 0, 255, 255),
color(0, 0, 255, 255),
color(255, 0, 255, 255),
color(0, 0, 255, 255),
color(255, 0, 255, 255),
color(0, 0, 255, 255),
color(255, 0, 255, 255),
color(0, 0, 255, 255)
}
local BFaces = {
{1,1,1,1},
{1,1,1,1},
{1,1,1,1},
{1,1,1,1},
{2,6,4,8},
{1,3,5,7}
}
test3 = addBlock{center = vec3(0,0,0), size = 100, color = colors, faces = BFaces}
end
function check()
if RGB == '651' then print("VICTORY!!!") else print("NOPE") end
end