Nothing better to do, so I took one of my existing programs and modified it a little. Once this is loaded, tap the screen. My wife is working puzzles to pass the time and I showed this to her and said it would make a good puzzle. She said no.
If you have some interesting code, post it here. Try to keep it small.
displayMode(FULLSCREEN)
function setup()
noSmooth()
rectMode(CORNER)
img=image(600,100)
setContext(img)
background(0, 0, 0, 255)
fill(255)
rect(0,0,600,100)
fill(0, 0, 0, 255)
ellipse(50,50,20)
ellipse(125,75,20) ellipse(175,25,20)
ellipse(525,75,20) ellipse(550,50,20) ellipse(575,25,20)
ellipse(425,75,20) ellipse(425,25,20) ellipse(475,75,20) ellipse(475,25,20)
ellipse(350,50,20) ellipse(325,75,20) ellipse(325,25,20)
ellipse(375,75,20) ellipse(375,25,20)
ellipse(225,75,20) ellipse(250,75,20) ellipse(275,75,20)
ellipse(225,25,20) ellipse(250,25,20) ellipse(275,25,20)
setContext()
scene = craft.scene()
assert(OrbitViewer, "Please include Cameras (not Camera) as a dependency")
viewer = scene.camera:add(OrbitViewer, vec3(0), 20, 0, 2000)
tab={}
xx=WIDTH//100
yy=HEIGHT//100
for x=-xx,xx do
for y=-yy,yy do
table.insert(tab,createDice(x,y,0))
end
end
end
function update(dt)
scene:update(dt)
end
function draw()
update(DeltaTime)
scene:draw()
if ss then
for a,b in pairs(tab) do
b.m.rotation=quat.eulerAngles(b.rx,b.ry,b.rz)
b.rx=b.rx+b.vx/20
b.ry=b.ry+b.vy/20
b.rz=b.rz+b.vz/20
end
end
end
function touched(t)
if t.state==BEGAN then
ss=not ss
end
end
function createDice(px,py,pz)
local rx,ry,rz=math.random(360),math.random(360),math.random(360)
local vx,vy,vz=math.random(-10,10),math.random(-10,10),math.random(-10,10)
local m=scene:entity()
m.position=vec3(px,py,pz)
m.rotation=quat.eulerAngles(rx,ry,rz)
m.model = craft.model.cube(vec3(.9,.9,.9))
m.material = craft.material(asset.builtin.Materials.Standard)
m.material.map = img
temp=m.model.indices
for z=#m.model.indices,1,-1 do
table.insert(temp,m.model.indices[z])
end
m.model.indices=temp
local uvs1={}
c=0
for x=1,6 do
table.insert(uvs1,vec2(c/6,0))
table.insert(uvs1,vec2((c+1)/6,0))
table.insert(uvs1,vec2((c+1)/6,1))
table.insert(uvs1,vec2(c/6,1))
c=c+1
end
m.model.uvs=uvs1
return({m=m,rx=rx,ry=ry,rz=rz,vx=vx,vy=vy,vz=vz})
end