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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -