vmars316 Posted May 15, 2016 Share Posted May 15, 2016 Hello & Thanks ; I am having trouble with my http://liesandcowpies.com/javascript/BenghaziGame.html Javascrtip and html are all one file : Prob: all buttons work fine, except for <button onmousedown="touchRightArrow" . the onmouseup="touchEndRight()" works fine . But I havent been able to figure out why <button onmousedown="touchRightArrow" isn't working . I need a new set of eyes to help me . I am happy to Post all code if necessary , but its 557 lines . <div id="canvasDiv" align="center" > <canvas id="canvas" width="800" height="550" style="background-color:#992D2D"></canvas> <br> <button onclick="myGameArea.pause()" ontouchstart="myGameArea.pause()" >Pause</button> <button onclick="myGameArea.play()" ontouchstart="myGameArea.play()" >Play</button> ___ <button onmousedown="touchLeftArrow()" onmouseup="touchEndLeft()" ontouchstart="touchLeftArrow()" ontouchend="touchEndLeft()">MoveLeft</button> _ <button onclick="touchUpArrow()" ontouchstart="touchUpArrow()">Throw</button> _ <button onmousedown="touchRightArrow" onmouseup="touchEndRight()" ontouchstart="touchRightArrow" ontouchend="touchEndRight()">MoveRight</button> ___ <button onclick="clearIt()" ontouchstart="clearIt()">Clear</button> <button onclick="quitIt()" ontouchstart="quitIt()">Quit</button> </div> // function touchRightArrow() { alert("function touchRightArrow() {"); thrower.directionX = 1; thrower.moveMe = true ; if (thrower.x > canvas.width -40) { thrower.moveMe = false ; } } // function touchEndRight() { //alert("function touchEndRight() {"); rightPressed = false ; thrower.moveMe = false ; drawThrower(); } // Link to comment Share on other sites More sharing options...
Don E Posted May 15, 2016 Share Posted May 15, 2016 Try adding parenthesis to onmousedown="touchRightArrow" : onmousedown="touchRightArrow()" 1 Link to comment Share on other sites More sharing options...
vmars316 Posted May 16, 2016 Author Share Posted May 16, 2016 Try adding parenthesis to onmousedown="touchRightArrow" : onmousedown="touchRightArrow()" Ah , perfect , Thanks Don I knew it would be something simple , just couldn't see it ...Vern Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now