szabloreki Posted March 23, 2017 Share Posted March 23, 2017 Hi everyone Can somebody tell me how I can check which sprite of the group [index] is colliding? example: this.game.physics.arcade.overlap(this.bullets, this.ENEMY.enemies, this.bulletsColision, null,this); function bulletsColision(bullets, enemies){ console.log(enemies.id of group); } Link to comment Share on other sites More sharing options...
Ad4m Posted March 24, 2017 Share Posted March 24, 2017 I'm not sure if this is the best approach but try this: this.game.physics.arcade.overlap(this.bullets, this.groupOfEnemies, this.bulletsColision, null,this); function bulletsColision(bullets, enemy) { console.log( this.groupOfEnemies.getIndex(enemy) ); } szabloreki 1 Link to comment Share on other sites More sharing options...
samme Posted March 25, 2017 Share Posted March 25, 2017 Remember, even when testing groups, the collision callback always contains two sprites: function bulletsColision(bullet, enemy) {/*…*/} szabloreki 1 Link to comment Share on other sites More sharing options...
szabloreki Posted March 25, 2017 Author Share Posted March 25, 2017 Thanks, Adam West it's work! Now I can complete my battle system in game! Link to comment Share on other sites More sharing options...
Recommended Posts