@dave1707 I figured it out but I feel like there is a simpler method.
displayMode(FULLSCREEN)
function setup()
spriteMode(CENTER)
ellipseMode(CENTER)
et=ElapsedTime
count=30
tab1={vec3(100,290,0),vec3(250,290,0),vec3(400,290,0)} -- position of large circles and occupied
tab2={vec2(800,100),vec2(800,250),vec2(800,400),vec2(800,550)} -- position of small circles
tab6={vec2(800,250),vec2(800,400),vec2(800,550)}
tab7={vec2(800,400),vec2(800,550)}
tab8={vec2(800,550)}
tab3={vec3(800,108,.5),vec3(800,258,.5),vec3(800,408,.5),vec3(800,558,.5)} -- position of sprite and scaler value
tab4={
asset.builtin.Planet_Cute.Character_Princess_Girl,
asset.builtin.Planet_Cute.Character_Boy,
asset.builtin.Planet_Cute.Character_Cat_Girl,
asset.builtin.Planet_Cute.Character_Horn_Girl
}
imageSize = spriteSize(tab4[1])
tab5={}
for z=1,#tab4 do
a=math.random(#tab4)
table.insert(tab5,tab4[a])
table.remove(tab4,a)
end
scaler = .50
end
function draw()
background(98)
strokeWidth(5)
fill(128)
for a,b in pairs(tab1) do
ellipse(b.x, b.y, 100)
end
for a,b in pairs(tab2) do
ellipse(b.x, b.y, 50)
end
fill(255)
if ElapsedTime-et>1 then
count = count - 1
et=ElapsedTime
end
if count<=28 then
for a,b in pairs(tab3) do
sprite(tab5[a],b.x,b.y,imageSize*b.z)
end
end
pushStyle()
fill(128)
if count==28 then
for a,b in pairs(tab6) do
ellipse(b.x, b.y, 50)
end
end
if count==27 then
for a,b in pairs(tab7) do
ellipse(b.x, b.y, 50)
end
end
if count==26 then
for a,b in pairs(tab8) do
ellipse(b.x, b.y, 50)
end
end
popStyle()
text(count,WIDTH*.10,HEIGHT*.10)
end
function touched(touch)
if touch.state==BEGAN then
pos=0
for a,b in pairs(tab3) do
if touch.x>b.x-40 and touch.x<b.x+40 and touch.y>b.y-40 and
touch.y<b.y+40 then
b.z=1 -- scaler
pos=a
for c,d in pairs(tab1) do
if b.x==d.x and b.y==d.y then
d.z=0
end
end
end
end
end
if pos==0 then
return
end
if touch.state==MOVING then
tab3[pos].x=tab3[pos].x+touch.deltaX
tab3[pos].y=tab3[pos].y+touch.deltaY
end
if touch.state==ENDED then
for a,b in pairs(tab1) do
if tab3[pos].x>b.x-55 and tab3[pos].x<b.x+55 and
tab3[pos].y>b.y-55 and tab3[pos].y<b.y+55 and
b.z==0 then
tab3[pos].x=b.x
tab3[pos].y=b.y
b.z=1
return
end
end
tab3[pos].x=tab2[pos].x
tab3[pos].y=tab2[pos].y
tab3[pos].z=.5
end
end