I want to be able to move my main character by 1 pixel if the player is touching the button image. The problem is that I have to keep tapping the button to move the character. Is there a way to detect if the player is continuously touching the button so I can continuously move the character?
Here’s the code that will move the character by 1 pixel across the screen.
[code]
function joystickControls(self, event)
if(event.phase == “began”) then
char.x = char.x + 1
end
end
button = display.newImageRect( “button.png”, 62, 51, true )
button.x = 120; button _Joystick.y = _H-40
button.touch = joystickControls
button ( “touch”, button )
[/code] [import]uid: 14218 topic_id: 13790 reply_id: 313790[/import]