Advertisement
xerpi

Untitled

Apr 11th, 2011
231
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.18 KB | None | 0 0
  1. cnv=1
  2. size=22
  3. --sound.loop("sonidos/loop1.mp3")
  4. function loading(text,colore)  --función cagando...
  5. if not colore then colore = color.new(255,255,255) end
  6. screen.print(480-5-screen.textwidth(tostring(text),0.8),272-15,tostring(text),0.8,colore,0x0)
  7. screen.flip()
  8. end
  9. loading("Cargando imágenes y niveles...")
  10. dofile("niveles.lua")
  11. middlex = 480/2
  12. middley = 272/2
  13. img={  --cargamos imágenes..
  14. violet=image.load("imagenes/blocks/violet.png"),
  15. quit=image.load("imagenes/blocks/quit.png"),
  16. green=image.load("imagenes/blocks/green.png")
  17. }
  18.  
  19.  
  20. function cargar()
  21. map=nil
  22. nivelactual=nil
  23. map={img = image.create(size*11,size*11),x=middlex-(11*size)/2,y=middley-(11*size)/2} --cremos una imagen donde se "guardará" el mapa
  24. nivelactual={
  25. {"e","e","e","e","e","e","e","e","e","e","e"},
  26. {"e","e","e","e","e","e","e","e","e","e","e"},
  27. {"e","e","e","e","e","e","e","e","e","e","e"},
  28. {"e","e","e","e","e","e","e","e","e","e","e"},
  29. {"e","e","e","e","e","e","e","e","e","e","e"},
  30. {"e","e","e","e","e","e","e","e","e","e","e"},
  31. {"e","e","e","e","e","e","e","e","e","e","e"},
  32. {"e","e","e","e","e","e","e","e","e","e","e"},
  33. {"e","e","e","e","e","e","e","e","e","e","e"},
  34. {"e","e","e","e","e","e","e","e","e","e","e"},
  35. {"e","e","e","e","e","e","e","e","e","e","e"}
  36. }
  37.  
  38. for y = 1, 11 do
  39.   for x = 1, 11 do
  40.      --nivel
  41.      if string.sub(nivel[cnv][y][x],1,1) == "q" or string.sub(nivel[cnv][y][x],2,2) == "q" then
  42.        map.img:blit((x-1)*size,(y-1)*size,img.quit)
  43.        --table.insert(blocks.grey,#blocks.grey+1,{x=x,y=y})
  44.        nivelactual[y][x]= "q"
  45.      elseif string.sub(nivel[cnv][y][x],1,1) == "g" or string.sub(nivel[cnv][y][x],2,2) == "g" then
  46.         map.img:blit((x-1)*size,(y-1)*size,img.green)
  47.         --table.insert(blocks.blue,#blocks.blue+1,{x=x,y=y})
  48.         nivelactual[y][x]= "g"
  49.      elseif string.sub(nivel[cnv][y][x],1,1) == "v" or string.sub(nivel[cnv][y][x],2,2) == "v" then
  50.         map.img:blit((x-1)*size,(y-1)*size,img.violet)
  51.         nivelactual[y][x]= "v"
  52.  
  53.      end
  54.  
  55.  end
  56. end
  57. end
  58. ----------------------------------------------------------
  59.  
  60. cargar()
  61.  
  62. while true do
  63. controls.read()
  64. map.img:blit(map.x,map.y)
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. screen.flip()
  72. if controls.select() then
  73. --sound.loop()
  74. xerpi() end
  75. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement