1 decade ago by npk75
Hi,
I can't wrap my head around this. And I now need your help. I new to impactjs.
I have the following entity with.
Now in the update function for the entity I can't not evaluate the sendTimer variable and only gets NaN. I can see that the variable works in the init function.
update function
What am I doing wrong here.
thanks for all your help.
/patric
I can't wrap my head around this. And I now need your help. I new to impactjs.
I have the following entity with.
EntityHero = ig.Entity.extend({ collides: ig.Entity.COLLIDES.ACTIVE, type: ig.Entity.TYPE.A, checkAgainst: ig.Entity.TYPE.B, size: {x:32, y:32}, animSheet: new ig.AnimationSheet('media/player.png',32,32), speed: 100, currentDirection: 'up', heroName: pname, sendTimer: 10,
Now in the update function for the entity I can't not evaluate the sendTimer variable and only gets NaN. I can see that the variable works in the init function.
update function
if (this.sendTimer < 0){ this.sendTimer = parseInt(10); socket.emit('PlayerMovement',this.pos.x,this.pos.y,this.currentDirection,this.heroName); } this.sendTimer = this.SendTimer-1; this.parent();
What am I doing wrong here.
thanks for all your help.
/patric