i wanna sprite one of 3 images every time?one by one?1.png?2.png?3.png?without regard xy position?is it a good way to store them into a table?is it a good way for many images?please give an example
A table is a good place to store images
--in setup
images = {readImage("Documents:myImage"),readImage("AnotherImage")}
--in draw
sprite(images[1],100,200)
sprite(images[2],200,400)
thanks?im gonna try it
--Load Images from Documents Folder
--rename images to C1,C2 .... C5
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
images={}
for i = 1,5 do
images[i] = readImage("Documents:C"..i)
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
for i=1,5 do
sprite(images[i],i*100,200)
end
end
it’s possible to load pictures in draw function too, but only one time. I’d a programme but i have lost. it was interesting for not loading all pictures of a website in the setup.
simply a flag for not loading picture twice in draw