Este es un update que estoy preparando para el juego fighter Revolution creado por mi y en el stage de pelea quiero hacer un fondo animado abajo esta lo que tengo pero se friquea me prodrian ayudar
dofile("game.lua") System.getFreeMemory() counter = Timer.new() loadicon0 = Image.load("./Back/BG/load00.bmp") loadicon1 = Image.load("./Back/BG/load01.bmp") loadicon2 = Image.load("./Back/BG/load02.bmp") loadicon3 = Image.load("./Back/BG/load03.bmp") loadicon4 = Image.load("./Back/BG/load04.bmp") loadicon5 = Image.load("./Back/BG/load05.bmp") loadicon6 = Image.load("./Back/BG/load06.bmp") loadicon7 = Image.load("./Back/BG/load07.bmp") loadicon8 = Image.load("./Back/BG/load08.bmp") loadicon9 = Image.load("./Back/BG/load09.bmp") loadicon10 = Image.load("./Back/BG/load010.bmp") loadicon11 = Image.load("./Back/BG/load011.bmp") loadicon12 = Image.load("./Back/BG/load012.bmp") loadicon13 = Image.load("./Back/BG/load013.bmp") loadicon14 = Image.load("./Back/BG/load014.bmp") loadicon15 = Image.load("./Back/BG/load015.bmp") loadicon16 = Image.load("./Back/BG/load016.bmp") loadicon17 = Image.load("./Back/BG/load017.bmp") loadicon18 = Image.load("./Back/BG/load018.bmp") loadicon19 = Image.load("./Back/BG/load019.bmp") loadicon20 = Image.load("./Back/BG/load020.bmp") loadicon21 = Image.load("./Back/BG/load021.bmp") loadicon22 = Image.load("./Back/BG/load022.bmp") loadicon23 = Image.load("./Back/BG/load023.bmp") loadicon24 = Image.load("./Back/BG/load024.bmp") loadicon25 = Image.load("./Back/BG/load025.bmp") loadicon26 = Image.load("./Back/BG/load026.bmp") loadicon27 = Image.load("./Back/BG/load027.bmp") loadicon28 = Image.load("./Back/BG/load028.bmp") loadicon29 = Image.load("./Back/BG/load029.bmp") loadicon30 = Image.load("./Back/BG/load030.bmp") loadicon31 = Image.load("./Back/BG/load031.bmp") load = {} load.x = 0 load.y = 0 load.img = loadicon0 red=Color.new(255,0,0) white=Color.new(255,255,255) r={Player,r1,r2,r3} l={Playerl,l1,l2,l3} lr={Player2,r12,r22,r32} ll={Playerl2,l12,l22,l32} Player={x=0,y=200,w=75,h=75,s=6,d=r,animt=0,img=Player,health=100,power=1,jumpstate = "ground",gravity=200,finisher=100,finish=10,j=0} Player2={x=400,y=200,w=75,h=75,d=ll,s=4,animt=0,img=Playerl2,health=100,power=1,finisher=100,finish=10,j=0} jumping=true ap=0 aj=0 moving=true movings=true movingss=true movingz=true shooting=true function movePlayer() pad=Controls.read() oldpad=Controls.read( ) counter=Timer.new( ) currentTime = counter:time() if pad:right( ) then Player.d=r anim(Player) Player.x = Player.x + Player.s else Player.img=Player.d[1] end if pad:left( ) then Player.d = l anim(Player) Player.x = Player.x - Player.s end if pad:cross( ) then Player.s = 0 movingss = true else if movingss and not pad:cross( ) then movingss = false Player.s = 6 end end if pad:cross() then Player.finisher=Player.finisher-10 ap=ap+1 if Player.d == r then Player.img = attackr else if Player.d == l then Player.img = attackl end end end if ap > 4 then if Player.d == r then Player.img = attackr2 ap = ap - 6 else if Player.d == l then Player.img = attackl2 ap = ap - 6 end end end if pad:triangle( ) and Player.jumpstate == "ground" then Player.jumpstate = "jumping" end if Player.jumpstate == "jumping" then Player.jumpspeed = Player.jumpspeed - 0.5 Player.gravity = Player.gravity - Player.jumpspeed end if Player.jumpstate == "jumping" then if Player.d == r then Player.img = jumpr else if Player.d == l then Player.img = jumpl end end end if Player.gravity < 0 then Player.jumpstate = "falling" end if Player.gravity <230 and Player.jumpstate == "falling" then Player.gravity = Player.gravity + (Player.jumpspeed + 3) end if Player.gravity == 200 then Player.jumpspeed = 10 Player.jumpstate = "ground" end if Player.gravity > 230 then Player.gravity = 200 end Player.y = Player.gravity if pad:circle( ) then Player.s = 0 moving = true else if moving and not pad:circle( ) then moving = false Player.s=6 end end if pad:circle( ) then if Player.d == r then Player.img = blockr else if Player.d == l then Player.img = blockl end end end if pad:square( ) then Player.s = 0 movingz = true else if movingz and not pad:square( ) then movingz = false Player.s=6 end end if pad:square( ) then Player.finisher=Player.finisher-10 aj=aj+1 if Player.d == r then Player.img = hattackr else if Player.d == l then Player.img = hattackl end end end if aj > 2 then if Player.d == r then Player.img = hattackr2 aj=aj-2 else if Player.d == l then Player.img = hattackl2 aj=aj-2 end end end if pad:r( ) then Player.s = 0 movingsss = true else if movingsss and not pad:square( ) then movingsss = false Player.s=6 end end if pad:r( ) then if Player.finisher < 1 then if Player.d == r then Player.img = finishr2 screen.waitVblankStart(30) Player.finisher = Player.finisher + 99 else if Player.d == l then Player.img = finishl2 screen.waitVblankStart(30) Player.finisher = Player.finisher+99 end end end end end if Player.finisher < 1 then Player.finisher = Player.finisher + 0 end if Player2.finisher < 1 then Player2.finisher = Player2.finisher + 0 end while true do screen:clear( ) movePlayer( ) AI(Player2) life( ) screen:blit(load.x,load.y,load.img) screen:blit(Player.x,Player.y,Player.img) screen:blit(Player2.x,Player2.y,Player2.img) screen:fillRect(5,10,Player.health,10,red) screen:fillRect(250,10,Player2.health,10,red) screen:fillRect(5,20,Player.finisher,10,white) screen:fillRect(250,20,Player2.finisher,10,white) counter:start() currentTime = counter:time() if currentTime >= 1 and currentTime < 100 then load.img = loadicon0 end if currentTime >= 100 and currentTime < 200 then load.img = loadicon1 end if currentTime >= 200 and currentTime < 300 then load.img = loadicon2 end if currentTime >= 300 and currentTime < 400 then load.img = loadicon3 end if currentTime >= 400 and currentTime < 500 then load.img = loadicon4 end if currentTime >= 500 and currentTime < 600 then load.img = loadicon5 end if currentTime >= 600 and currentTime < 700 then load.img = loadicon6 end if currentTime >= 700 and currentTime < 800 then load.img = loadicon7 end if currentTime >= 800 and currentTime < 900 then load.img = loadicon8 end if currentTime >= 900 and currentTime < 1000 then load.img = loadicon9 end if currentTime >= 1000 and currentTime < 1100 then load.img = loadicon10 end if currentTime >= 1100 and currentTime < 1200 then load.img = loadicon11 end if currentTime >= 1200 and currentTime < 1300 then load.img = loadicon12 end if currentTime >= 1300 and currentTime < 1400 then load.img = loadicon13 end if currentTime >= 1400 and currentTime < 1500 then load.img = loadicon14 end if currentTime >= 1500 and currentTime < 1600 then load.img = loadicon15 end if currentTime >= 1600 and currentTime < 1700 then load.img = loadicon16 end if currentTime >= 1700 and currentTime < 1800 then load.img = loadicon17 end if currentTime >= 1800 and currentTime < 1900 then load.img = loadicon18 end if currentTime >= 1900 and currentTime < 2000 then load.img = loadicon19 end if currentTime >= 2000 and currentTime < 2100 then load.img = loadicon20 end if currentTime >= 2100 and currentTime < 2200 then load.img = loadicon21 end if currentTime >= 2200 and currentTime < 2300 then load.img = loadicon22 end if currentTime >= 2300 and currentTime < 2400 then load.img = loadicon23 end if currentTime >= 2400 and currentTime < 2500 then load.img = loadicon24 end if currentTime >= 2500 and currentTime < 2600 then load.img = loadicon25 end if currentTime >= 2600 and currentTime < 2700 then load.img = loadicon26 end if currentTime >= 2700 and currentTime < 2800 then load.img = loadicon27 end if currentTime >= 2800 and currentTime < 2900 then load.img = loadicon28 end if currentTime >= 2900 and currentTime < 3000 then load.img = loadicon29 end if currentTime >= 3000 and currentTime < 3100 then load.img = loadicon30 end screen.flip( ) screen.waitVblankStart( ) end
CrackDevice!!! - http://crackdevice.com Solo colabora, entra y aclara sus dudas, todos sobre tu iDevice.
Te resultará..
Muchísimo más fácil utilizar esta librería Lua que te permite poner un fondo animado y parecerá como si fuera una imágen en movimiento o más bién una imágen .GIF.
Tampoco sobrecargues de imágenes ya que se tragaría la memoria RAM del PSP y se te congelaría.
.::AnimLib::.
PD: Te recomiendo que conviertas las imágenes en .PNG.
Hazme la pregunta que quieras ANONIMAMENTE desde aquí.
Pues yo no recomiendo animation lib para nada.
Cuando yo lo usé no me llegó ha funcionar bien.. tenia errores.
Te recomendaria evitar animaciones que ocupen todo un fondo, o imprimir el fondo i solo poner imagenes de lo que se mueva, si es un escenario y por ejemplo aparecen pajaros, no cargues una imagen con todo el fondo todo el rato, usa solo el fondo y luego pajaros.
Y yo usaria solo .png si necesitaras transparencia, pero al ser el fondo usa .jpg, suelen ocupar bastante menos.
Saludos.
Como ya te dijeron, tantas
Como ya te dijeron, tantas frames es exagerado, y tu psp se frikea?? Se pone a ver star wars o algo así??XD
Saludos
Qué bestias sois
Es una burrada usar 31 variables para guardar los frames de una animación. ¿Y si tuviera 200 frames?. ¿Harías 200 variables?. Por favor, leer un poco de metodología de programación antes de hacer esas barbaridades, esto es lo que pasa cuando se empieza a construir una casa sin saber siquiera qué son los ladrillos. Meted los frames en un VECTOR, en vez de en decenas de variables. Ese código es infumable.
PD: Sobre lo de que se cuelga puede ser a que cuando currentTime >= 3100 ya no hay nada que hacer, y no veo que lo vuelvas a resetear.
NOTA: Espero que mi comentario no te moleste, no he querido ofenderte, los foros como este están para aprender. He querido sólo darte un consejo muy básico de programacion.
LuaDiE: Crea en Lua sin teclear código. Compatible HM7, HMv2, LuaPlayer, LuaDEV y PGE.