Anuncios Google

Ayuda animlib,sprites[SOLICITO A CHIMECHO][CERRADO]

Verán tengo un problema lo qué pasa es qué cuándo uso la libreria animlib junto a sprites no funciona :S

TODO lo que esta dentro de un comentario es lo que quiero que funcione con la animlib pero cuándo lo uso me da error en la linea

238

dofile("animlib.lua")
dofile("weaponlib.lua")
bala = {img=image.load("sprites/bowl/1.png"),x=5,y=5,w=20,h=20}
fondo = image.load("fondo.jpg")
bola = {img=image.load("sprites/bowl/1.png")}
jugador = {}
jugador["parado"]={}
jugador["paseo"]={}
 colision = {img=image.load("xd.png"),x=179,y=18,w=120,h=10}
 
enemigo={img=image.load("sprites/enemigo.png"),w=20,h=30,x1=170,y1=0,x=170,y=18,x2=270,y2=0,dir="r",vel=1}
enemigo2={img=image.load("sprites/enemy2.png"),w=20,h=30,x1=100,y1=0,x=150,y=68,x2=320,y2=0,dir="r",vel=3}
enemigo3={img=image.load("sprites/enemy3.png"),w=20,h=30,x1=80,y1=0,x=100,y=38,x2=290,y2=0,dir="r",vel=3}
enemigo4={img=image.load("sprites/enemy4.png"),w=20,h=30,x1=50,y1=0,x=100,y=88,x2=340,y2=0,dir="r",vel=5}
 
flowmaster = {x=170,y=18,w=20,h=30}
 
jugador.parado.up = image.load("sprites/arribaparado.png")
jugador["parado"].down = image.load("sprites/abajoparado.png")
jugador.parado["right"] = image.load("sprites/derechaparado.png")
jugador["parado"]["left"] = image.load("sprites/izquierdaparado.png")
 
arriba = image.loadsprite("sprites/arriba.png",27,50)
abajo = image.loadsprite("sprites/abajo.png",27,50)
derecha = image.loadsprite("sprites/derecha.png",27,50)
izquierda = image.loadsprite("sprites/izquierda.png",27,50)
 
 
rawset(jugador["paseo"],"up",arriba)
rawset(jugador["paseo"],"down",abajo)
rawset(jugador["paseo"],"right",derecha)
rawset(jugador["paseo"],"left",izquierda)
 
 function move(object)
if object.dir=="r" then 
	object.x=object.x+object.vel
elseif object.dir=="l" then 
	object.x=object.x-object.vel
end
if object.dir=="r" and object.x>=object.x2+1 then
	object.dir="l"
end
if object.dir=="l" and object.x<=object.x1-1 then
	object.dir="r"
end
end
 function move2(object)
if object.dir=="r" then 
	object.x=object.x+object.vel
elseif object.dir=="l" then 
	object.x=object.x-object.vel
end
if object.dir=="r" and object.x>=object.x2+1 then
	object.dir="l"
end
if object.dir=="l" and object.x<=object.x1-1 then
	object.dir="r"
end
end
 function move3(object)
if object.dir=="r" then 
	object.x=object.x+object.vel
elseif object.dir=="l" then 
	object.x=object.x-object.vel
end
if object.dir=="r" and object.x>=object.x2+1 then
	object.dir="l"
end
if object.dir=="l" and object.x<=object.x1-1 then
	object.dir="r"
end
end
 
 
status = "parado" 
direction = "down" 
array = {}
array.x = 10 
array.y = 50 
array.w = 27
array.h = 50
nauti = 0 
 bowl = true
 nautilus = true
 disparo =  weapon.create(bala.img,5,100)
 weapon.action(disparo,"start")
 function colin(objeto1,objeto2)
if objeto1.x+objeto1.w > objeto2.x and objeto1.x < objeto2.x+objeto2.w and
objeto1.y +objeto1.h > objeto2.y and objeto1.y < objeto2.y + objeto2.h  then 
os.message("mh")
end
end
--animacion = anim.create(arriba,27,50,0.1)
--animacion:start()
--animacion2 = anim.create(abajo,27,50,0.1)
--animacion2:start()
--animacion3 = anim.create(izquierda,27,50,0.1)
--animacion3:start()
--animacion4 = anim.create(derecha,27,50,0.1)
--animacion4:start()
 
movimientoarriba = true
movimientoabajo = false
movimientoizquierda = false
movimientoderecha = false
 
nivel1 = true
nivel2 = false
nivel3 = false
while true do
	controls.read()
	colision.img:blit(colision.x,colision.y)
	               fondo:blit(0,0)
if nivel1 == true then		       
if weapon.blit(disparo,true,colision.x,colision.y,colision.w,colision.h) then
os.message("Avanza al siguiente nivel")
nivel1 = false
nautilus = true
bowl = true
nivel2 = true
array.y = array.y + 100
end
end
if nivel3 == true then
if weapon.blit(disparo,true,colision.x,colision.y,colision.w,colision.h) then
os.message("Avanza al siguiente nivel")
nivel2 = false
array.y = array.y + 100
bowl = true
nautilus = true
 
end
end
 
if nivel2 == true then
if weapon.blit(disparo,true,colision.x,colision.y,colision.w,colision.h) then
os.message("Avanza al siguiente nivel")
nivel1 = false
array.y = array.y + 100
bowl = true
nautilus = true
nivel3 = true
end
end
 
if nivel1 == true then
if weapon.blit(disparo,true,enemigo.x,enemigo.y,enemigo.w,enemigo.h) then
os.message("Has perdido")
end
end
 
 
if direction == "up" then
	if nautilus == true then
if controls.r() then
	weapon.shoot(disparo,array.x + 6+array.w/2-disparo.w/2-1,array.y - 1,"up",laser)
	nautilus = false
	bowl = false
end
end
end
if direction == "right" then
	if nautilus == true then
 
if controls.r() then
	weapon.shoot(disparo,array.x + 25+array.w/2-disparo.w/2-1,array.y + 25,"right",laser)
	nautilus = false
	bowl = false
end
end
end
if direction == "left" then
	if nautilus == true then
 
if controls.r() then
	weapon.shoot(disparo,array.x - 15+array.w/2-disparo.w/2-1,array.y + 25,"left",laser)
	nautilus = false
	bowl = false
end
end
end
if direction == "down" then
	if nautilus == true then
 
if controls.r() then
	weapon.shoot(disparo,array.x + 3+array.w/2-disparo.w/2-1,array.y + 50,"down",laser)
	nautilus = false
	bowl = false
end
end
end
 if controls.press("l") then
 dofile("SDF")
 end
	if controls.up() or controls.down() or controls.left() or controls.right() then
		nauti = nauti + 0.1
		status = "paseo"
		if math.floor(nauti)>2 then
			nauti = 0
		end
	else
	if bowl == true then
bola.img:blit(array.x + 15,array.y + 29)
end
		nauti = 0
		status = "parado"
	end
 
	if controls.up() then
	if bowl == true then
          bola.img:blit(array.x + 6,array.y - 1)
         end
		array.y = array.y-2
		direction = "up"
	elseif controls.down() then
	if bowl == true then
bola.img:blit(array.x + 3,array.y + 50)
end
		array.y=array.y+2
		direction = "down"
	elseif controls.right() then
	if bowl == true then
bola.img:blit(array.x + 25,array.y + 25)
end
		array.x=array.x+2
		direction = "right"
	elseif controls.left() then
	if bowl == true then
bola.img:blit(array.x - 15,array.y + 25)
end
		array.x=array.x-2
		direction = "left"
		end
 
 
	if status=="paseo" then
		jugador[status][direction]:setframe(nauti)
	end
 
	array.x = math.min(math.max(0,array.x), 480-22)
	array.y = math.min(math.max(0,array.y), 272-27)
 
	jugador[status][direction]:blit(array.x,array.y)
	if nivel1 == true then
 colin(array,enemigo)
 end
 if nivel2 == true then
  colin(array,enemigo2)
  colin(array,enemigo3)
  end
 weapon.blit(disparo)
 
--animacion:blit(50,58)
move(enemigo)
--move2(enemigo2)
--move3(enemigo3)
if nivel1 == true then
enemigo.img:blit(enemigo.x,enemigo.y)
end
if nivel3 == true then
colin(array,enemigo2)
colin(array,enemigo3)
colin(array,enemigo4)
end
if nivel3 == true then
nivel2 = false
move(enemigo2)
move(enemigo3)
move(enemigo4)
enemigo4.img:blit(enemigo4.x,enemigo4.y)
enemigo2.img:blit(enemigo2.x,enemigo2.y)
enemigo3.img:blit(enemigo3.x,enemigo3.y)
if weapon.blit(disparo,true,enemigo2.x,enemigo2.y,enemigo2.w,enemigo2.h) then
os.message("Has perdido")
nautilus = true
end
if weapon.blit(disparo,true,enemigo3.x,enemigo3.y,enemigo3.w,enemigo3.h) then
os.message("Has perdido")
nautilus = true
end
if weapon.blit(disparo,true,enemigo4.x,enemigo4.y,enemigo4.w,enemigo4.h) then
os.message("Has perdido")
nautilus = true
end
end
 
if nivel2 == true then
move(enemigo2)
move(enemigo3)
if weapon.blit(disparo,true,enemigo2.x,enemigo2.y,enemigo2.w,enemigo2.h) then
os.message("Has perdido")
end
if weapon.blit(disparo,true,enemigo3.x,enemigo3.y,enemigo3.w,enemigo3.h) then
os.message("Has perdido")
end
 
--if nivel4 == true then
--nivel3 = false
--if array.x > flowmaster.x then
--movimientoderecha = true
--flowmaster.x = flowmaster.x + 1.5
--end
--if array.x < flowmaster.x then
--movimientoizquierda = true
--flowmaster.x = flowmaster.x - 1.5
--end
--if array.y > flowmaster.y then
--movimientoabajo = true
--	flowmaster.y = flowmaster.y + 1.5
--end
--end
 
 
--if array.y < car.y then
	--car.y = car.y - 3
--end
enemigo2.img:blit(enemigo2.x,enemigo2.y)
enemigo3.img:blit(enemigo3.x,enemigo3.y)
 
end
--if movimientoarriba == true then
--animacion:blit(flowmaster.x,flowmaster.y)
--end
--if movimientoabajo == true then
--animacion2:blit(flowmaster.x,flowmaster.y)
--end
--if movimientoizquierda == true then
--animacion3:blit(flowmaster.x,flowmaster.y)
--end
--if movimientderecha == true then
--animacion4:blit(flowmaster.x,flowmaster.y)
--end
 
screen.flip()
end


Follow me twitter nautilus1_jmccu!!
Sony, ya a nadie le interesa tus UMD si alguien compra una psp es por nosotros los coders. Madura y has un FW que haga la diferencia y anime a las personas en comprar un PSP


Anuncios Google

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.
Imagen de Chimecho

ehm...

Si lees bien la noticia:

anim.create(spritesheet, ancho, alto, tiempo)
-- crea y devuelve un objeto de animación a partir de una hoja de sprites, los cuadros, se obtendrán de la imagen spritesheet (debe ser previamente cargada con image.load), y serán dividos de izquierda a derecha y de arriba hacia abajo. Los cuadros se dividen en partes iguales según el ancho y alto especificado.
 
anim.create(ruta, ancho, alto, tiempo)
-- crea y devuelve un objeto de animación a partir de una hoja de sprites, los cuadros, se obtendrán de la imagen localizada en la ruta especificada, y serán dividos de izquierda a derecha y de arriba hacia abajo. Los cuadros se dividen en partes iguales según el ancho y alto especificado.

....

no veo donde dice para cargar con loadsprite



PSP FAT [5.00 M33-6] [6.60 ME] [Hard Moded] / Nintendo Wii [4.1U] [cIOS Hermes] [D2X cIOS] / iPhone 3G [4.2.1] [BB 05.13.04] [redsn0w] / iPod Touch 4 [6.1] [evasi0n]

07/05/10: Tuve el placer de llamarle con todo derecho "N00B" a molotovi xDDD

Recuerda: Sé el intérprete -_-

Imagen de NauTiluS1

Entonces tengo qué cargar de

Entonces tengo qué cargar de nuevo? :O

Imagen de Nevado0

te lo dije xD

te lo dije xD

Imagen de NauTiluS1

Bah nunca me lo dijiste =_=

Bah nunca me lo dijiste =_= xD

Imagen de Nevado0

>_< por el msn te dije q no

>_< por el msn te dije q no haci falta los loadsprite !

Imagen de NauTiluS1

OMG, es qué aveces habro el

OMG, es qué aveces habro el msn y ni lo uso xD

Nah, cierro el post.

Imagen de Chimecho

...

o le pasas la ruta...

Imagen de NauTiluS1

Tal linea es

Tal linea es esta:

jugador[status][direction]:setframe(nauti)

Opciones de visualización de comentarios

Seleccione la forma que prefiera para mostrar los comentarios y haga clic en «Guardar las opciones» para activar los cambios.