1 decade ago by jelani435
Hey guys, I'm working on adding some movement logic to an entity. Here's the code:
whenever I launch my game, I get this error.
Uncaught SyntaxError: Unexpected token ILLEGAL
Can anyone tell me how to fix this?
ig.module( 'game.entities.zombie' )
.requires( 'impact.entity' )
.defines(function() {
EntityZombie = ig.Entity.extend({
animSheet: new ig.AnimationSheet( 'media/zombie.png', 16, 16),
size: {x: 8, y:14},
offset: {x:4, y:2},
maxVel: {x:100, y: 100},
flip: false,
init: function(x, y, settings) {
this.parent(x, y, settings);
this.addAnim('walk', 0.7, [0,1,2,3,4,5]);
}
update: function() {
//Return if near an edge
if(!ig.game.collisionMap.getTile(
this.pos.x + (this.flip ? +4 : this.size.x -4),
this.pos.y + this.size.y+1
)
) {
this.flip = !this.flip;
}
var xdir = this.flip ? -1 : 1;
this.vel.x = this.speed * xdir;
this.currentAnim.flip.x = this.flip;
this.parent();
},
whenever I launch my game, I get this error.
Uncaught SyntaxError: Unexpected token ILLEGAL
Can anyone tell me how to fix this?
