Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cnv=1
- size=22
- --sound.loop("sonidos/loop1.mp3")
- function loading(text,colore) --función cagando...
- if not colore then colore = color.new(255,255,255) end
- screen.print(480-5-screen.textwidth(tostring(text),0.8),272-15,tostring(text),0.8,colore,0x0)
- screen.flip()
- end
- loading("Cargando imágenes y niveles...")
- dofile("niveles.lua")
- middlex = 480/2
- middley = 272/2
- img={ --cargamos imágenes..
- violet=image.load("imagenes/blocks/violet.png"),
- quit=image.load("imagenes/blocks/quit.png"),
- green=image.load("imagenes/blocks/green.png")
- }
- function cargar()
- map=nil
- nivelactual=nil
- map={img = image.create(size*11,size*1),x=middlex-(11*size)/2,y=middley-(11*size)/2} --cremos una imagen donde se "guardará" el mapa
- nivelactual={
- {"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","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"}
- }
- for y = 1, 11 do
- for x = 1, 11 do
- --nivel
- if string.sub(nivel[cnv][y][x],1,1) == "e" or string.sub(nivel[cnv][y][x],2,2) == "e" then
- --map.img:blit((x-1)*size,(y-1)*size,img.grey)
- --table.insert(blocks.grey,#blocks.grey+1,{x=x,y=y})
- nivelactual[y][x]= "e"
- elseif 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.green)
- --table.insert(blocks.blue,#blocks.blue+1,{x=x,y=y})
- nivelactual[y][x]= "g"
- elseif string.sub(nivel[cnv][y][x],1,1) == "v" or string.sub(nivel[cnv][y][x],2,2) == "v" then
- map.img:blit((x-1)*size,(y-1)*size,img.violet)
- nivelactual[y][x]= "v"
- end
- end
- end
- end
- ----------------------------------------------------------
- cargar()
- while true do
- controls.read()
- map.img:blit(map.x,map.y)
- screen.flip()
- if controls.select() then
- --sound.loop()
- xerpi() end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement