Im trying to define this class, and later instantiate it and call some of it's methods.
function Layer(){
this.image = null;
this.owned = false;
this.sim = false;
this.pos = 0.5;
this.vel = 0;
this.acc = 0;
this.lastup = millis();
this.newpos = 0;
this.scrub = scrub;
function scrub(npos){
this.newpos = npos;
this.vel = 0;
this.acc = 0;
}
}
dummy = new Layer();
dummy.scrub(0.8);
// chrome says Uncaught TypeError: Object #<an Object> has no method 'scrub'
Am I defining the methods correctly?