1 decade ago by wands
I'm trying to get the angle from my entity to another entity, but i got error messages
I got 2 js files, one is call player1.js while the other is call player2.js
Inside player1.js I have this line of code declared in the update() function
var angle = this.angleTo(EntityPlayer2);
I'm using weltmeister to load up both my entities.
Then i got this error messages. I'm not an experience coder, so would be really grateful if anyone could point out my mistake. :)
Uncaught TypeError: Cannot read property 'y' of undefined entity.js:197
ig.Entity.ig.Class.extend.angleTo entity.js:197
ig.Entity.extend.update player1.js:37
(anonymous function) impact.js:506
ig.Game.ig.Class.extend.updateEntities game.js:212
ig.Game.ig.Class.extend.update game.js:189
ig.Game.extend.update main.js:55
(anonymous function) impact.js:506
ig.Game.ig.Class.extend.run game.js:170
ig.System.ig.Class.extend.run system.js:108
animate
I got 2 js files, one is call player1.js while the other is call player2.js
Inside player1.js I have this line of code declared in the update() function
var angle = this.angleTo(EntityPlayer2);
I'm using weltmeister to load up both my entities.
Then i got this error messages. I'm not an experience coder, so would be really grateful if anyone could point out my mistake. :)
Uncaught TypeError: Cannot read property 'y' of undefined entity.js:197
ig.Entity.ig.Class.extend.angleTo entity.js:197
ig.Entity.extend.update player1.js:37
(anonymous function) impact.js:506
ig.Game.ig.Class.extend.updateEntities game.js:212
ig.Game.ig.Class.extend.update game.js:189
ig.Game.extend.update main.js:55
(anonymous function) impact.js:506
ig.Game.ig.Class.extend.run game.js:170
ig.System.ig.Class.extend.run system.js:108
animate