Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[--- INITIAL VALUES -----]]
- display.setStatusBar( display.HiddenStatusBar )
- local btn = display.newImageRect("button.png",150,150)
- btn.x = display.contentWidth/2
- btn.y = display.contentHeight/2
- btn:setFillColor( 255,0,20 )
- local text = display.newText( "Click", 0, 0, native.systemFont, 30)
- text.x = display.contentWidth/2
- text.y = display.contentHeight/2
- local tapCount = 0
- local tapText = display.newText( tapCount, 0, 0, native.systemFont, 30 )
- tapText.x = display.contentWidth/2
- tapText.y = display.contentHeight/2
- tapText:setFillColor( 0, 0, 0 )
- amountOfTimeYouClicked = 0
- testText = display.newText( amountOfTimeYouClicked, display.contentWidth/4, display.contentHeight/4 , Arial, 30 )
- test1Text = display.newText( "You Have Clicked it this many times:", display.contentWidth/2.5, display.contentHeight/6 , Arial, 15 )
- local function pushBtn(event)
- if event.phase == "began" then
- amountOfTimeYouClicked = amountOfTimeYouClicked + 1
- print( amountOfTimeYouClicked )
- testText = tostring(amountOfTimeYouClicked)
- end
- end
- btn:addEventListener( "touch", pushBtn )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement