Advertisement
Guest User

Untitled

a guest
Mar 9th, 2013
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.20 KB | None | 0 0
  1. menu = 1
  2.  
  3. function love.keypressed(key)
  4.     if key == "up" then
  5.         menu = menu - 1
  6.     elseif key == "down" then
  7.         menu = menu + 1
  8.     end
  9.  
  10. end
  11.  
  12. function love.draw()
  13.  
  14.     cursor = love.graphics.newImage("cursor.png")
  15.  
  16.     love.graphics.setCaption("Maze Game")
  17.    
  18.     love.graphics.setColor(0, 0, 255)
  19.     if menu == 1 then
  20.         love.graphics.setColor(255, 0, 0)
  21.         love.graphics.draw(cursor, 300, 200)
  22.     end
  23.     love.graphics.print("Jugar", 320, 200, 0, 2, 2)
  24.    
  25.  
  26.     love.graphics.setColor(0, 0, 255)
  27.     if menu == 2 then
  28.         love.graphics.setColor(255, 0, 0)
  29.         love.graphics.draw(cursor, 300, 300)
  30.     end
  31.     love.graphics.print("Opciones", 320, 300, 0, 2, 2)
  32.    
  33.    
  34.     love.graphics.setColor(0, 0, 255)
  35.     if menu == 3 then
  36.         love.graphics.setColor(255, 0, 0)
  37.         love.graphics.draw(cursor, 300, 400)
  38.     end
  39.     love.graphics.print("Salir", 320, 400, 0, 2, 2)
  40.  
  41.  
  42. end
  43.  
  44. function love.update()
  45.  
  46.     if menu > 3 then
  47.         menu = 1
  48.     elseif menu < 1 then
  49.         menu = 3
  50.     end
  51.  
  52.     if menu == 1 and love.keyboard.isDown("return") then
  53.         require("level1")
  54.     end
  55.    
  56.     if menu == 2 and love.keyboard.isDown("return") then
  57.         require("menu2")
  58.     end
  59.    
  60.     if menu == 3 and love.keyboard.isDown("return") then
  61.         love.event.push("quit")
  62.     end
  63.    
  64. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement