Advertisement
Guest User

corona

a guest
Oct 22nd, 2017
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. --[[--- INITIAL VALUES -----]]
  2. display.setStatusBar( display.HiddenStatusBar )
  3. local btn = display.newImageRect("button.png",150,150)
  4.  
  5. btn.x = display.contentWidth/2
  6. btn.y = display.contentHeight/2
  7. btn:setFillColor( 255,0,20 )
  8.  
  9. local text = display.newText( "Click", 0, 0, native.systemFont, 30)
  10. text.x = display.contentWidth/2
  11. text.y = display.contentHeight/2
  12. local tapCount = 0
  13. local tapText = display.newText( tapCount, 0, 0, native.systemFont, 30 )
  14. tapText.x = display.contentWidth/2
  15. tapText.y = display.contentHeight/2
  16. tapText:setFillColor( 0, 0, 0 )
  17.  
  18.  
  19.  
  20. amountOfTimeYouClicked = 0
  21. testText = display.newText( amountOfTimeYouClicked, display.contentWidth/4, display.contentHeight/4 , Arial, 30 )
  22. test1Text = display.newText( "You Have Clicked it this many times:", display.contentWidth/2.5, display.contentHeight/6 , Arial, 15 )
  23. local function pushBtn(event)
  24. if event.phase == "began" then
  25.  
  26. amountOfTimeYouClicked = amountOfTimeYouClicked + 1
  27. print( amountOfTimeYouClicked )
  28. testText = tostring(amountOfTimeYouClicked)
  29. end
  30. end
  31. btn:addEventListener( "touch", pushBtn )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement