Amado Posted July 10, 2015 Share Posted July 10, 2015 HiCan I use divs as virtual controls? I have a div called "leftButton" and I want you to hold down the function "turnLeft()" is executed.The idea is that the vehicle turn left while the div is pressed. URL Test var interval; $("#leftButton").mousedown(function () { interval = setInterval(function() { game.state.states.main.turnLeft(); }, 50); }).mouseup(function () { clearInterval(interval); });On mobiles, currently the operation is not correct, since a delay or the car continues to rotate indefinitely occurs.Desktop works by pressing the div with the mouse.My goal is to use divs for the interface (Buttons, records, lives, etc.), around the game screen. Kind regards PD. Sorry for my English language Link to comment Share on other sites More sharing options...
Recommended Posts