Im creating a program to move object repeatedly using javascript. Functions work when they are separated but when I try to use OOP pattern it gives a strange error repeatedly saying
Uncaught TypeError: this.Move is not a function
Here is my code
function Bot(){
this.XPos =0;
this.YPos=0;
this.AsyncMove=setInterval(function(){
this.XPos+=10;
this.YPos+=10;
this.Move();
},100);
}
Bot.prototype = {
constructor:Bot,
Move:function(){
console.log(this.XPos+" ,"+this.YPos);
}
};