Guest User

Untitled

a guest
Jul 19th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.35 KB | None | 0 0
  1. inscription = Image.load("images/inscription.png")
  2. inscription2 = Image.load("images/inscription2.png")
  3. continuer = Image.load("images/continuer.png")
  4. valider = Image.load("images/valider.png")
  5. selecteur = Image.load("images/selecteur.png")
  6. curseur = Image.load("images/curseur.png")
  7.  
  8. rouge = Color.new(255,0,0)
  9.  
  10. x = 240
  11. y = 135
  12. y2 = 0
  13. mouseover = 0
  14. statut = 0
  15. statutinscription = 0
  16.  
  17. MotDePasse = ""
  18. mdp = io.open("pass.txt","r")
  19. lire = mdp:read()
  20.  
  21. pseudo = ""
  22. pseudonyme = io.open("pseudo.txt","r")
  23. lire2 = pseudonyme:read()
  24.  
  25. minuteur = Timer.new()
  26. minuteur:stop()
  27.  
  28. function deplacementcurseur()
  29.   if pad:up() then
  30.     y = y - 2.5
  31.   end
  32.   if pad:down() then
  33.     y = y + 2.5
  34.   end
  35.   if pad:left() then
  36.     x = x - 2.5
  37.   end
  38.   if pad:right() then
  39.     x = x + 2.5
  40.   end
  41.  
  42.   dx = pad:analogX()
  43.   if math.abs(dx) > 27 then
  44.     x = x + dx / 25
  45.   end
  46.  
  47.   dy = pad:analogY()
  48.   if math.abs(dy) > 27 then
  49.     y = y + dy / 25
  50.   end
  51.  
  52.   if x >= 480 then
  53.     x = 480
  54.   end
  55.  
  56.   if x <= 0 then
  57.     x = 0
  58.   end
  59.  
  60.   if y >= 272 then
  61.     y = 272
  62.   end
  63.  
  64.   if y <= 0 then
  65.     y = 0
  66.   end
  67. end
  68.  
  69. oldpad = Controls.read()
  70.  
  71. while true do
  72.   pad = Controls.read()
  73.   screen:clear()
  74.   if statut == 0 then
  75.     screen:blit(0,y2,inscription)
  76.     if y >= 194 and y2 == 0 then
  77.       y2 = -78
  78.     elseif y <= 78 and y2 == -78 then
  79.       y2 = 0
  80.     elseif y2 == -78 and y >= 222 and y <= 242 and x >= 190 and x <= 290 then
  81.       screen:blit(190,222,continuer)
  82.       if pad:cross() then
  83.         statut = 1
  84.       end
  85.     elseif not(y2 == -78 and y >= 222 and y <= 242 and x >= 190 and x <= 290) then
  86.       mouseover = 0
  87.     end
  88.   end
  89.  
  90.   if statut == 1 then
  91.     screen:blit(0,0,inscription2)
  92.     minuteur:start()
  93.     currenttime = minuteur:time()
  94.     if x >= 190 and x <= 290 and y >= 230 and y <= 250 then
  95.       screen:blit(190,230,valider)
  96.       if pad:cross() and currenttime >= 1000 then
  97.         if MotDePasse ~= lire and pseudo ~= lire2 then
  98.           if lire == "0" then
  99.             mdp:write(MotDePasse.."\n")
  100.             mdp:close()
  101.             mouseover = 0
  102.             statut = 2
  103.           end
  104.         end
  105.       end
  106.     end
  107.   end
  108.   if statut == 1 then
  109.   if x >= 220 and x <= 370 and y >= 96 and y <= 116 then
  110.     screen:blit(220,96,selecteur)
  111.     if pad:cross() then
  112.       pseudo = System.startOSK(pseudo,"pseudo")
  113.     end
  114.   elseif x >= 220 and x <= 370 and y >= 126 and y <= 146 then
  115.     screen:blit(220,126,selecteur)
  116.     if pad:cross() then
  117.       MotDePasse = System.startOSK(MotDePasse,"mot de passe")
  118.     end
  119.   elseif x >= 220 and x <= 370 and y >= 156 and y <= 176 then
  120.     mouseover = 4
  121.     screen:blit(220,156,selecteur)
  122.   elseif not(x >= 190 and x <= 290 and y >= 230 and y <= 250) and not(x >= 220 and x <= 370 and y >= 96 and y <= 116) and not(x >= 220 and x <= 370 and y >= 126 and y <= 146) and not(x >= 220 and x <= 370 and y >= 156 and y <= 176) then
  123.     mouseover = 0
  124.   end
  125.  
  126.   if pseudo ~= nil then
  127.   screen:print(222,100,pseudo,blanc)
  128.   end
  129.   if MotDePasse ~= nil and MotDePasse ~= "" then
  130.   screen:print(221,130,"****",blanc)
  131.   end
  132.   if mdp2 ~= nil and mdp2 ~= "6546516546216" then
  133.   screen:print(221,160,"****",blanc)
  134.   end
  135.   end
  136.  
  137.   if pad:select() then
  138.     break
  139.   end
  140.  
  141.   deplacementcurseur()
  142.   screen:blit(x,y,curseur)
  143.  
  144.   screen.waitVblankStart()
  145.   screen.flip()
  146.   oldpad = pad
  147. end
Add Comment
Please, Sign In to add comment