Hello, I’m a new, totally inexperienced programmer, came across Codea a few months ago. But for the lack of tutorials, I couldn’t learn much yet. Of course I found @Ignatz books, they are really helpful. But I still have some problems. Like this…
I just made a project, where I need to get the list of assets in my “Documents” assets pack. I have a parameter that would get the asset pack name, add the current indexed asset name and pass the two values to a variable. The variable would then pass the total name (ex-“Asset pack:Asset key”) as a key to the sprite command in draw. The sprite command would then draw the image at the centre of the screen. This is the code
-- Tables -- Use this function to perform your initial setup function setup() Assetchange=assetList("Documents",SPRITES) for i,v in pairs(Assetchange) do print(i,v) parameter.integer("Assets",1,#Assetchange,1) Image="Documents:"..v end end -- This function gets called once every frame function draw() -- This sets a dark background color background(40, 40, 50) -- This sets the line thickness strokeWidth(5) -- Do your drawing here sprite(Image,WIDTH/2,HEIGHT/2) text(Assets,WIDTH/2,HEIGHT/2) fill(255, 23, 0, 255) end
But when I run the code, I find only the last asset is drawn, and I can’t choose the asset through the parameter slider. Please help me.