I´m trying to slide two images, one from left to right and the other one from right to left. When both images dissapear from screen I load another two images.
The problem is when I´ve loaded 5 or 6 images, lua shows the "load error image". I tryed to change the image, the path, also checked the correct filename and path.
The program works fine in the lua player windows version. What´s wrong?
The follow table WORKS because it only has 3 images per table. If I try to insert 4 images in every table the program crashes.The other new images are good files because if I put them alone in the table, they work (I also convert them into png files).
animacion1 = {a1=Image.load("imagen/foto00.jpg"),a2=Image.load("imagen/foto02.jpg"),a3=Image.load("imagen/foto04.jpg")}
animacion2 = {b1=Image.load("imagen/foto01.jpg"),b2=Image.load("imagen/foto03.jpg"),b3=Image.load("imagen/foto05.jpg")}
x1=-150
x2=480
cont=0
animacionxx=animacion1.a1
animacionyy=animacion2.b1
while true do
screen:blit(0, 0, fondo)
screen:blit(x1, 100, animacionxx)
screen:blit(x2, 25, animacionyy)
x1=x1 + 1
if x1 == 480 then
x1=-150
cont=cont+1
if cont == 1 then
animacionxx=animacion1.a2
elseif cont== 2 then
animacionxx=animacion1.a3
elseif cont== 3 then
animacionxx=animacion1.a1
end
end
x2=x2 - 1
if x2 == -150 then
x2=480
if cont == 1 then
animacionyy=animacion2.b2
elseif cont== 2 then
animacionyy=animacion2.b3
elseif cont== 3 then
cont=0
animacionyy=animacion2.b1
end
end
screen.waitVblankStart()
screen.flip()
pad=Controls.read()
if pad:start() then
break
end
end
here is another way using a double array
for i=1,2 do --number of animated sequences
yourpic[i] = {}
for j=1,3 do --number of images per sequence
yourpic[i][j] = Image.load("yourpic" .. i .. "" .. j .. ".png")
end
end
time = 0
sequence = 1
picnumber = 1
while true do
screen:blit(24,12,yourpic[sequence][picnumber, true)
time = time +1
if time == 20 then
picnumber = picnumber + 1
time = 0
end
if sequence == 3 then
sequence = 1
end
end
i hope this helps ill explain some more
u would need these pics
yourpic11.png
yourpic12.png
yourpic13.png
yourpic21.png
yourpic22.png
yourpic23.png
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks