Advertisement
xerpi

adivina lol

Aug 28th, 2011
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.88 KB | None | 0 0
  1. fondo = {c=1} for i = 1, 3 do fondo[i] = image.load("imagenes/fondo"..i..".png") end
  2. sb = image.load("imagenes/SB2011.png")
  3. adivinanza = {img ={},current = 17}
  4. adivinanza.respuesta ={"mesa","jabon","puerta","iglesia","pincel","camposanto","radio","tunera","reloj","moneda","escoba","candado"}
  5. for i = 1, 255 do
  6.     sb:blend(0,0,i)
  7.     screen.flip()
  8. end
  9. for i = 17,28 do
  10.     adivinanza.img[i] = image.load("imagenes/adivinanza"..i..".png")
  11. end
  12. for i = 255, 1,-1 do
  13.     sb:blend(0,0,i)
  14.     screen.flip()
  15. end
  16. function menu()
  17.     while true do
  18.         controls.read()
  19.         fondo[fondo.c]:blit(0,0)
  20.         if controls.press("down") then fondo.c = fondo.c +1 end if fondo.c > #fondo then fondo.c = 1 end
  21.         if controls.press("up")   then fondo.c = fondo.c -1 end if fondo.c < 1 then fondo.c = #fondo end
  22.         screen.flip()
  23.         if controls.press("cross") then
  24.             if fondo.c == 1 then jugar()
  25.             elseif fondo.c == 2 then os.message("Code: Pepingo el hacker\nGraficos de inicio: Deinouse\nAgradecimientos Especiales: Xerpi\nAgradecimientos por librerias: Rober Galarga")
  26.             else os.exit() end
  27.         end
  28.         --if controls.select() then a() end
  29.         end
  30. end  
  31. function jugar()
  32.     while true do
  33.         controls.read()
  34.         adivinanza.img[adivinanza.current]:blit(0,0)
  35.         if controls.press("r") then adivinanza.current = math.min(28,adivinanza.current+1)  end
  36.         if controls.press("l") then adivinanza.current = math.max(17,adivinanza.current-1)  end
  37.         screen.flip()
  38.         if controls.press("cross") then
  39.             if string.lower(os.osk("Escribe una respuesta:","",100,10,0)) == adivinanza.respuesta[adivinanza.current-16] then
  40.                 os.message("Has acertado!!! Gracias por Jugar =D")
  41.                 adivinanza.current = adivinanza.current +1
  42.                 if adivinanza.current > 28 then os.message("Te has pasado el juego!") adivinanza.current = 17 menu() end
  43.             else os.message("Has fallado!!!! No pasas de Nivel :(")
  44.             end
  45.         end
  46.         if controls.start() then menu() end
  47.     end
  48. end
  49. menu()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement