Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -----------------------NIVELES.LUA
- --(TODO VACIO XD)
- nivel={
- {--1
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"}
- },
- {--2
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"}
- },
- {--3
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"},
- {"e","e","e","e","e","e","e","e"}
- }
- }
- ----------------SCRIPT.LUA
- cnv=1 --nivel actual
- size=25 --tamaño de los bloques (wii o psp)
- function loading(text) --función cagando...
- screen.print(480-5-screen.textwidth(tostring(text),0.8),258,tostring(text),0.8,color.new(255,255,255),0x0)
- screen.flip()
- end
- loading("Cargando niveles...")
- dofile("niveles.lua")
- loading("Cargando imágenes...")
- map={img = image.create(size*8,size*8),x=480/2-size*8/2,y=272/2-size*8/2} --cremos una imagen donde se "guardará" el mapa
- img={empty=image.load("imagenes/blocks/empty.png"),
- grey=image.load("imagenes/blocks/grey.png"),
- blue=image.load("imagenes/blocks/blue.png"),
- brown=image.load("imagenes/blocks/brown.png")
- }
- arrow={d=image.load("imagenes/arrows/arrowd.png"),u=image.load("imagenes/arrows/arrowu.png"),
- l=image.load("imagenes/arrows/arrowl.png"),r=image.load("imagenes/arrows/arrowr.png")}
- arrowp={d=image.load("imagenes/arrows/arrowd.png"),u=image.load("imagenes/arrows/arrowpu.png"),
- l=image.load("imagenes/arrows/arrowpl.png"),r=image.load("imagenes/arrows/arrowpr.png")}
- for y = 1, #nivel[cnv] do
- for x = 1, #nivel[cnv][y] do
- if string.sub(nivel[cnv][y][x],1,1) == "g" or string.sub(nivel[cnv][y][x],2,2) == "g" then
- map.img:blit((x-1)*size,(y-1)*size,img.grey)
- elseif string.sub(nivel[cnv][y][x],1,1) == "b" or string.sub(nivel[cnv][y][x],2,2) == "b" then
- map.img:blit((x-1)*size,(y-1)*size,img.blue)
- elseif string.sub(nivel[cnv][y][x],1,1) == "m" or string.sub(nivel[cnv][y][x],2,2) == "m" then
- map.img:blit((x-1)*size,(y-1)*size,img.brown)
- elseif string.sub(nivel[cnv][y][x],1,1) == "e" then
- map.img:blit((x-1)*size,(y-1)*size,img.empty)
- end
- end
- end
- ----------------------------------------------------------
- while true do
- controls.read()
- map.img:blit(map.x,map.y)--bliteamos la imagen del mapa
- screen.flip()
- if controls.select() then a() end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement