I am trying to make a function run 60 times per second. So I've declared setInterval(this.updateAt60, 1/60*1000);
in this class' constructor.
This is the function that should be called repeatedly:
LightingScene.prototype.updateAt60 = function(){
this.controlSubmarine();
this.submarine.setPosition();
}
Yet, I'm getting the error Uncaught TypeError: this.controlSubmarine is not a function
and I can call it everywhere on the code except on there. The order of function declaration is constructor/ controlSubmarine/ updateAt60.
What am I doing wrong?
Thank you in advance.