Advertisement
xerpi

adsfs

Jan 16th, 2012
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.03 KB | None | 0 0
  1. blanco = color.new(255,255,255)
  2. rojo = color.new(255,0,0)
  3. azul = color.new(0,0,255)
  4. negro = color.new(0,0,0)
  5. menu = 1
  6. menu2 = 2
  7. fondo = image.load("imagenes/menu.png")
  8. sound.loop("sonido/sonido.mp3")
  9.  
  10. opciones_del_menu = {
  11.     "JUGAR",
  12.     "COMO JUGAR"
  13.     "ESTADISTICAS",
  14.     "OPCIONES",
  15.     "ACERCA DE"
  16.     "SALIR"
  17. }
  18.  
  19. function menu juego()
  20.     while true do
  21.         fondo:blit(0,0)
  22.         controls.read()
  23.         --Pintar las opciones  
  24.             if menu2 == 1 then
  25.                 screen.print(159,108,"COMO JUGAR",1,azul,blanco)
  26.                 screen.print(174,150,"OPCIONES",1,azul,blanco)
  27.             end
  28.             if menu2 == 1 then
  29.                 screen.print(159,108,"COMO JUGAR",1,azul,blanco)
  30.                 screen.print(174,150,"OPCIONES",1,azul,blanco)
  31.             end    
  32.         --Mover entre el menu
  33.             if controls.press("up") or controls.press("left") then
  34.                 menu2 = menu2-1
  35.                 if menu2 < 1 then menu2 = 2 end    
  36.             end
  37.             if controls.press("down") or controls.press("right") then
  38.                 menu2 = menu2+1
  39.                 if menu2 > 2 then menu2 = 1 end
  40.             end
  41.         --Al pulsar X:
  42.             if controls.press("cross") then
  43.                 if menu2 == 1 then
  44.                     dofile("Nivel1.lua")
  45.                 elseif menu2 == 1 then
  46.                     dofile("NivelP.lua")
  47.                 end
  48.             end
  49.         screen.flip();
  50.     end
  51. end
  52.    
  53.    
  54.        
  55. while true do
  56.     controls.read()
  57.     fondo:blit(0,0)
  58.     --Pintar las opciones
  59.         for i = 1, #opciones_del_menu do
  60.             if i == menu then
  61.                 screen.print(190,85+(i-1)*21,opciones_del_menu[i],rojo,blanco)
  62.             else
  63.                 screen.print(190,85+(i-1)*21,opciones_del_menu[i],azul,blanco)
  64.             end
  65.         end
  66.     --Mover entre el menu
  67.         if controls.press("up") or controls.press("left") then
  68.             menu = menu-1
  69.             if menu < 1 then menu = 6 end
  70.         end
  71.         if controls.press("down") or controls.press("right") then
  72.             menu = menu+1
  73.             if menu > 6 then menu = 1 end
  74.         end
  75.     --Al pulsar X:
  76.         if controls.press("cross") then
  77.             if menu == 1 then
  78.                 dofile("Nivel1.lua")
  79.             elseif menu == 2 then
  80.                 dofile("NivelP.lua")
  81.             elseif menu == 3 then
  82.            
  83.             elseif menu == 4 then
  84.            
  85.             elseif menu == 5 then
  86.            
  87.             elseif menu == 6 then
  88.                 menu_juego()
  89.             end
  90.         end
  91.     screen.flip()
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement