I’m trying to set this code up so it displays 1 random image from my table, which holds 8 images ,on screen 1 at a time.
I’m halfway there. I got the images to display randomly but they are stacked on each other. Also I’m trying to set it up so if one image from the table gets displayed it won’t show up twice.
displayMode(FULLSCREEN)
function setup()
et=ElapsedTime
count=30
tab={ asset.builtin.Planet_Cute.Character_Princess_Girl,
asset.builtin.Planet_Cute.Character_Boy,
asset.builtin.Planet_Cute.Character_Horn_Girl,
asset.builtin.Planet_Cute.Character_Pink_Girl,
asset.builtin.Space_Art.UFO,
asset.builtin.Planet_Cute.Enemy_Bug,
asset.builtin.Planet_Cute.Key,
asset.builtin.Planet_Cute.Gem_Green, }
bTab={}
for x=-20,20 do
for y=-20,20 do
table.insert(bTab,{x=x,y=y,v=math.random(13)})
end
end
dx,dy=WIDTH/2,HEIGHT/2
end
function draw()
background(0)
if ElapsedTime-et>1 then
count = count - 1
et=ElapsedTime
end
text(count,WIDTH/2,HEIGHT/2)
if count<=29 then
for a,b in pairs(bTab) do
if b.v<7 then
sprite(tab[b.v],dx+200,dy)
else
if count<=28 then
sprite(tab[b.v-5],dx,dy+200)
end
if count<=27 then
sprite(tab[b.v],dx,dy-200)
end
end
end
end
end