javascript - Uncaught SyntaxError: Unexpected token this Javasctript Error -
trying create actor class html5 game, uncaught syntaxerror. not sure @ means or how fix it. other questions jquery , couldn't find solutions fit problem.
function actor(x, y){ //... this.direction = 270; //... } actor.prototype.update = function(){ if(this.speed >= this.maxspeed) this.speed = this.maxspeed; if(key.isdown(key.getcode("a")) this.direction -= 1; // < -- error occurs here if(key.isdown(key.getcode("d")) this.direction +=1; if(key.isdown(key.getcode(" ") this.move(); }
if(key.isdown(key.getcode("a")) this.direction -= 1;
you have 3 opening parens, , 2 closing ones.
if(key.isdown(key.getcode("a"))) this.direction -= 1; // ^ added
you have multiple lines same problem. correct them all.
Comments
Post a Comment