how about taking out two of the periods.Zitat:
Zitat von Grimfate126
like:
...unless the names of your images have two periods after the numbers, then I dont know.Code:ct[a] = Image.load("ct..a.png")
Printable View
how about taking out two of the periods.Zitat:
Zitat von Grimfate126
like:
...unless the names of your images have two periods after the numbers, then I dont know.Code:ct[a] = Image.load("ct..a.png")
no you need two periods to concatenate.
Zitat:
Zitat von EminentJonFrost
nope, ur and altairs method dont work. i think there was another guy who asked this, and pspmillionaire side you had to use a "tostring" function to get it to work. i cant find that page tho. :(
doesn't work? Do you have the pics in the same folder as the lua file?Code:ct = {}
for a = 1, 300 do
ct[a] = Image.load("ct"..a..".png")
end
Zitat:
Zitat von Altair
wow, now that works.. weird. thx!
not weird at all. And no prob! What was it? the quotations or the place of the pics? If you want i can explain it.
i havent the sligest idea. first it didnt work i copied your code. and bam, it worked. YOUR MAGIC. :Jump: :Jump:Zitat:
Zitat von Altair
abracadabra!
hehe, nice to hear
oh...i get it now.
i didnt know that worked with images too...
Does it pretty much work wherever qoutation marks are used?
Okay this is getting on my last nerve.... ive tried a MILLION things and it wont do what i want it to do... i need to have it so when I press triangle it plays it back. But currently i have to hold it. also whenever i playback once it wont work again, ill have to restart the app to make it playback again... oh and it only plays 3 frames not 6
Code:System.usbDiskModeActivate()
oldpad = Controls.read()
red = Color.new(255,0,0)
black = Color.new(0,0,0)
white = Color.new(255,255,255)
f = {}
f[1] = Image.load("frame#1.png")
f[2] = Image.load("frame#2.png")
f[3] = Image.load("frame#3.png")
f[4] = Image.load("frame#4.png")
f[5] = Image.load("frame#5.png")
f[6] = Image.load("frame#6.png")
canvas = Image.createEmpty(480, 272)
canvas:clear(white)
x0 = 200
y0 = 200
x1 = 100
y1 = 100
frame = 0
speed = 1
counter = 0
function playback()
counter = counter + speed
if counter == 1 then
screen:blit(0,0, f[1])
screen.flip()
screen.waitVblankStart(5)
elseif counter == 2 then
screen:blit(0,0,f[2])
screen.flip()
screen.waitVblankStart(5)
elseif counter == 3 then
screen:blit(0,0, f[3])
screen.flip()
screen.waitVblankStart(5)
elseif counter == 4 then
screen:blit(0,0,f[4])
screen.flip()
screen.waitVblankStart(5)
elseif counter == 5 then
screen:blit(0,0, f[5])
screen.flip()
screen.waitVblankStart(5)
elseif counter == 6 then
screen:blit(0,0, f[6])
screen.flip()
screen.waitVblankStart(5)
end
end
while true do --MAIN LOOP
canvas:print(2, 20, "Frame: " .. frame, black)
pad = Controls.read()
dx = pad:analogX()
if math.abs(dx) > 32 then
x0 = x0 + dx / 64
end
dy = pad:analogY()
if math.abs(dy) > 32 then
y0 = y0 + dy / 64
end
if pad:cross() then
canvas:drawLine(x0, y0, x1, y1, black)
end
if pad:r() and oldpad:r() ~= pad:r() then
frame = frame + 1
screen:save("frame#" .. frame.. ".png")
canvas:clear(white)
end
if pad:triangle() then
playback()
end
if pad:square() then
canvas:clear(white)
end
if pad:start() then
break
end
x1 = x0
y1 = y0
screen:blit(0, 0, canvas, 0, 0, canvas:width(), canvas:height(), false)
screen:drawLine(x1 - 5, y1, x1 + 5, y1, red)
screen:drawLine(x1, y1 - 5, x1, y1 + 5, red)
screen.waitVblankStart()
screen.flip()
oldpad = pad
end