Advertisement
xerpi

sadsf

Jan 23rd, 2012
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.38 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.                         else
  28.                                 screen.print(159,108,"COMO JUGAR",1,azul,blanco)
  29.                                 screen.print(174,150,"OPCIONES",1,azul,blanco)
  30.                         end            
  31.                 --Mover entre el menu
  32.                         if controls.press("up") or controls.press("left") then
  33.                                 menu2 = menu2-1
  34.                                 if menu2 < 1 then menu2 = 2 end        
  35.                         end
  36.                         if controls.press("down") or controls.press("right") then
  37.                                 menu2 = menu2+1
  38.                                 if menu2 > 2 then menu2 = 1 end
  39.                         end    
  40.                 --Al pulsar X:
  41.                         if controls.press("cross") then
  42.                                 if menu2 == 1 then
  43.                                         dofile("Nivel1.lua")
  44.                                 elseif menu2 == 2 then
  45.                                         dofile("NivelP.lua")
  46.                                 end
  47.                         end
  48.                 screen.flip();
  49.         end
  50. end
  51.        
  52.        
  53.                
  54. while true do
  55.         controls.read()
  56.         fondo:blit(0,0)
  57.         --Pintar las opciones
  58.                 for i = 1, #opciones_del_menu do
  59.                         if menu == i then
  60.                                 screen.print(190,85+(i-1)*21,opciones_del_menu[i],1,rojo,blanco)
  61.                         else
  62.                                 screen.print(190,85+(i-1)*21,opciones_del_menu[i],1,azul,blanco)
  63.                         end
  64.                 end
  65.         --Mover entre el menu
  66.                 if controls.press("up") or controls.press("left") then
  67.                         menu = menu-1
  68.                         if menu < 1 then menu = 6 end
  69.                 end
  70.                 if controls.press("down") or controls.press("right") then
  71.                         menu = menu+1
  72.                         if menu > 6 then menu = 1 end
  73.                 end
  74.         --Al pulsar X:
  75.                 if controls.press("cross") then
  76.                         if menu == 1 then
  77.                                 dofile("Nivel1.lua")
  78.                         elseif menu == 2 then
  79.                                 dofile("NivelP.lua")
  80.                         elseif menu == 3 then
  81.                        
  82.                         elseif menu == 4 then
  83.                        
  84.                         elseif menu == 5 then
  85.                        
  86.                         elseif menu == 6 then
  87.                                 menu_juego()
  88.                         end
  89.                 end
  90.         screen.flip()
  91. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement