donpink Posted May 29, 2015 Share Posted May 29, 2015 Hello,i try to compare my enemies position to my player position to make theme pursue the player.My issue is that i have three JS, Enemy.js, Player.js ans Game.js If i try to get this.player.x in the Enemy.js, it won't be able to find player (Cannot read property 'x' of null) even if i declare it at start ( this.player.x = null; ). If i try to make it in the Game.js, where the enemies are contains in a group, i can't have the position of each ( console.log(this.enemyGroup.forEach.x); is undefined ). Can someone help me ? You can see the start of my game at www.alekostolle.com/www I need some help for my functions, so if someone is willing to help, he will be very welcome ! Link to comment Share on other sites More sharing options...
Recommended Posts