Okay so I am quite new, I've got the player to move using up, down, right, and left. But what I am trying to do is make the character move with a left click.
var Player = function(id){
var self = {
x:250,
y:250,
id:id,
number:"" + Math.floor(10 * Math.random()),
pressingRight:false,
pressingLeft:false,
pressingUp:false,
pressingDown:false,
maxSpd:10,
}
self.updatePosition = function(){
if(self.pressingRight)
self.x += self.maxSpd;
if(self.pressingLeft)
self.x -= self.maxSpd;
if(self.pressingUp)
self.y -= self.maxSpd;
if(self.pressingDown)
self.y += self.maxSpd;
}
return self;
}
That's what I have for the up, down, left, right movement. I've seen a few documents stating the click but just can't seem to implement it into the file.