Advertisement
xerpi

simon

Apr 19th, 2011
289
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.67 KB | None | 0 0
  1. math.randomseed(os.time())
  2.  
  3. --13 Triángulo
  4. --14 Círculo
  5. --15 Cruz
  6. --16 Cuadrado
  7.  
  8. blanco = color.new(255,255,255)
  9. secuencia = {}
  10.  
  11. acumulador = 1
  12. aciertos = 0
  13.  
  14.  
  15. function añadir()
  16. table.insert(secuencia,math.random(13,16))
  17. end
  18.  
  19. for i = 1, 4 do --añadimos 4 secuencias
  20. añadir()
  21. end
  22.  
  23. while true do
  24.  controls.read()
  25.  
  26. for i = 1, #secuencia do
  27.     screen.print(100,10+(i-1)*15,secuencia[i])
  28. end
  29. screen.print(130,10+(acumulador-1)*15,"aquí")
  30. screen.flip()  
  31.  
  32. if controls.waitforkey() == secuencia[acumulador] then
  33.     os.message("Bien!")
  34.     acumulador=acumulador+1
  35. else os.message("Mal")
  36.     acumulador=1
  37.  
  38. end
  39.  if controls.select() then a() end
  40.  
  41.  end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement