What I am trying to achieve is changing the way a player moves in a JQuery game.
Rather than a keypress I am trying to get the player to move if they click/mousedown on text, with id "left".
Original code is as follows.
if(jQuery.gameQuery.keyTracker[65]){ //this is left! (a)
var nextpos = parseInt($("#player").css("left"))-5;
if(nextpos > 0){
$("#player").css("left", ""+nextpos+"px");
}
}
My code is as follows, and when I play, it just continuously moves the player left without me pressing anything. It shouldn't move left until I click or mousedown on the "left" id text.
if ($('#left').mousedown){
var nextpos = parseInt($("#player").css("left"))-5;
if(nextpos > 0){
$("#player").css("left", ""+nextpos+"px");
}
}