donpink Posted May 30, 2015 Share Posted May 30, 2015 I wanted to compare the distance between the player and each ennemies, but it can't seems to work.Anybody has an idea how to do it ? Link to comment Share on other sites More sharing options...
donpink Posted May 30, 2015 Author Share Posted May 30, 2015 I tried if(Enemy.epx > this.player.x +30){ console.log("vueeee"); Enemy.evx = 300; } -----------------epx = ennemie position xevx = enemy velocity x But the console log work even when i am in the sky and the velocity don't grow. Link to comment Share on other sites More sharing options...
MikeT Posted May 30, 2015 Share Posted May 30, 2015 Using Arcade physics? pursueSpeed = 300;game.physics.arcade.moveToObject(Enemy, this.player, pursueSpeed); Link to comment Share on other sites More sharing options...
donpink Posted May 30, 2015 Author Share Posted May 30, 2015 I made a function sees2:function(player, enemy) { this.physics.arcade.moveToObject(this.enemyGroup, this.player, 300, 4); }, And call it in the update if(Enemy.epx > this.player.x +30) { this.sees2();} It keep telling me something is wrong with this line: this.physics.arcade.moveToObject(this.enemyGroup, this.player, 300, 4); To see the game: http://alekostolle.com/www/game.html Link to comment Share on other sites More sharing options...
Recommended Posts