Advertisement
xerpi

Untitled

Apr 14th, 2011
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.10 KB | None | 0 0
  1. rojo = color.new( 255, 0, 0 )
  2. azul = color.new( 0, 0, 255)
  3. verde = color.new( 0, 255,0)
  4. size=0.8
  5.  
  6. tiempo={}
  7.  
  8. crono={tiempo=timer.new(),status="pause"}
  9. crono.tiempo:reset(); crono.tiempo:stop();
  10.  
  11. while true do
  12. controls.read()
  13.  
  14.  
  15. for i = 1, #tiempo do
  16.     screen.print(200,50+(i-1)*16,i..": ",size,verde,0x0)
  17.     screen.print(200+screen.textwidth(i..": "),50+(i-1)*16,tiempo[i],size,rojo,0x0)
  18. end
  19.  
  20. if controls.press("cross") then
  21.     if crono.tiempo:time() == 0 then
  22.         crono.tiempo:start()
  23.         crono.status="running"
  24.     elseif crono.tiempo:time() > 0 then
  25.         table.insert(tiempo,crono.tiempo:time()/1000)
  26.     end
  27. end
  28.  
  29. if controls.press("start") then
  30.     if crono.status == "pause" then
  31.         crono.tiempo:start()
  32.         crono.status="running"
  33.     elseif crono.status == "running" then
  34.         crono.tiempo:stop()
  35.         crono.status="pause"
  36.     end
  37. end
  38. if controls.press("circle") then
  39.     crono.tiempo:reset(); crono.tiempo:stop();
  40.     crono.status="pause"
  41. end
  42.  
  43. if controls.r() and controls.l() then
  44.     tiempo={}
  45. end
  46.  
  47.  
  48. screen.print(200,20,crono.tiempo:time()/1000,size,azul,0x0)
  49.  
  50. if controls.select() then a() end
  51.  
  52. screen.flip()
  53. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement