[Resolved] How to move character when is pressed down?

Hey I’m having a small trouble in making an object move a button is pressed. I know how to move the character. But my real problem is I want to move the character when the button is kept down press instead of tapin , over and over, and over Just to have it move. I want it to move when button is pressed down like a real button. Here is how I have it.

local function movel (event) if event.phase == "began" then player:setLinearVelocity( 200, 0 ) end end leftb:addEventListener("touch", movel)

How do I make it so I’m not tapping it every time to move it, but just pressing down for the player to move.

Thanks [import]uid: 17058 topic_id: 26349 reply_id: 326349[/import]

You could have a timer fire at regular intervals. Each time it fires it checks the state of the button. If the button is pressed it moves the character.

This is pretty basic control and there are as many ways to do this as there are stars in the sky. Play with it and try different things. [import]uid: 8271 topic_id: 26349 reply_id: 106798[/import]

@horacebury sorry for being such a newbie, but I’m getting lost on how to do it [import]uid: 17058 topic_id: 26349 reply_id: 106799[/import]

Use :setFocus at initial press, start move timer and track. When the user releases, kill the timer mentioned by horacebury. [import]uid: 21331 topic_id: 26349 reply_id: 106805[/import]

I got it thanks for both of you for pitching in and helping I appreciate it thanks :slight_smile: [import]uid: 17058 topic_id: 26349 reply_id: 106823[/import]