EnnekPL

Untitled

Aug 12th, 2014
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.40 KB | None | 0 0
  1. -----------------------------------------------------------------------------------------
  2. --
  3. -- main.lua
  4. --
  5. -----------------------------------------------------------------------------------------
  6.  
  7. -- Your code here
  8. local tlo = display.newImage("")
  9. tlo.x = 160
  10. tlo.y = 255
  11. tlo.rotation = 90
  12. math.randomseed(os.time())
  13.  
  14. local tekst2 = display.newText( "-------------------------------------------------", 1, 1, native.systemFont, 40 )
  15. local tekst1 = display.newText( "Random Lesson", 160, 30, native.systemFont, 40 )
  16. local tekst3 = display.newText( "-------------------------------------------------", 1, 50, native.systemFont, 40 )
  17. local tekst5 = display.newText( "-------------------------------------------------", 1, 200, native.systemFont, 40 )
  18. local tekst6 = display.newText( "-------------------------------------------------", 1, 300, native.systemFont, 40 )
  19. local widget = require( "widget" )
  20.  
  21. function pokaWynik()
  22.  local wynik = math.random(31 + 1)
  23.  return wynik
  24. end
  25.  
  26. local wynik = display.newText("?", 160, 250, native.systemFont, 30)
  27.  
  28. local function handleButtonEvent( event )
  29.  
  30.     if ( "ended" == event.phase ) then
  31.         wynik:removeSelf()
  32.         wynik = nil
  33.         wynik = display.newText(pokaWynik(), 160, 250, native.systemFont, 30)
  34.     end
  35. end
  36.  
  37. local button1 = widget.newButton
  38. {
  39.     left = 50,
  40.     top = 400,
  41.  
  42.     id = "losuj",
  43.     label = "Losuj",
  44.     onEvent = handleButtonEvent
  45. }
Advertisement
Add Comment
Please, Sign In to add comment