Last active
April 16, 2018 02:02
-
-
Save Mr-Coxall/1713d3c464c6ab2e3617d8063f92dfae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- simple touch code | |
local theBall = display.newImage( "./assets/sprites/ball.png" ) | |
theBall.x = display.contentCenterX | |
theBall.y = display.contentCenterY | |
theBall.id = "ball object" | |
local function onBallTouched( event ) | |
if ( event.phase == "began" ) then | |
print( "Touch event began on: " .. event.target.id ) | |
elseif ( event.phase == "ended" ) then | |
print( "Touch event ended on: " .. event.target.id ) | |
end | |
return true | |
end | |
theBall:addEventListener( "touch", onBallTouched ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment