function Load()
local BG = Image.load("Data/Loading/Background.png")
local Loading1 = Image.load("Data/Loading/Loading1.png")
local Loading2 = Image.load("Data/Loading/Loading2.png")
while not Controls.read():start() do
screen:blit(0,0, BG)
screen:blit(362,254, Loading1)
screen.waitVblankStart()
screen.flip()
L2FI()
end
end
I am trying to get it to loop the Loading1 and loading2 files. The loading1 file is just a .png that says loading and the loading2 file is the same but the word was outlined with blue, giving it a glowing effect. Anyone have an idea for what I can do?
function Load()
local timer = 1
local BG = Image.load("Data/Loading/Background.png")
loading = {}
Loading[1] = Image.load("Data/Loading/Loading1.png")
Loading[2] = Image.load("Data/Loading/Loading2.png")
while not Controls.read():start() do
screen:blit(0,0, BG)
screen:blit(362,254, loading[timer])
if(timer == 2) then
timer = 1
elseif(timer == 1) then
timer = 2
end
screen.waitVblankStart()
screen.flip()
L2FI()
end
end
if you want a delay between each picture, use "screen.waitVblackStart(#)"
That one didnt seem to give you much of a challange! =P Here is one I have been having a problem with.
Ok, have you ever loaded linux and seen the way the files load at startup, they scroll down the screen and after each one it says "........Done".
I would like to get all the files, folders and sub-folders in my program directory to be printed to the screen in that way. I can get it to list the files in the first
folder, but it list them all ontop of each other so you cant read them, and it also keep listing them over and over causing it to keep reading from the memory card.
1) read the files from ms..
2) create an table for the lines you want to print
3) create an loop and print out the table... (top down)
4) add at the end of the loop add one entry from the filelist to the "empty" table [table.insert]
5) repeat step 4 until the table is full
6) remove the first entry from the table... [table.remove]
7) repeat and repeat....
8) done
9) enjoy
10) say thanks
greets
lumo
PS: i think thats what you wanted to?
"Good artists copy, great artists steal." Pablo Picasso go2lumo.com
Just for your refrence. People will generally offer ideas to code it not how to do it, but since im nice. I shall provide you with a simple example with what to do.
--
-- Please refer to the directory first.
--
local dir = System.listDirectory()
local i = 1
for k, v in dir do
if (not v["directory"]) then
local len = string.len(v.name)
if (string.sub(v.name,len-3,len-3) == ".") then
-- String has an extension.
if (string.sub(v.name,len-2,len) == "lua") then
screen:print(0, i*8, "Loading "..v.name, Color.new(255, 255, 255))
require(v.name)
screen.waitVblankStart()
screen.flip()
i = i+1
end
end
end
end
Please note this is untested code, learn it live it love it.
For each file in the loop. Check if the extension is ".lua" then print out the line where as the y position is moved i*8. (Meaning you setup a var to tell it to go down a line area so it doesnt write over itself).