szabloreki Posted March 23, 2017 Report 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); } Quote Link to comment Share on other sites More sharing options...
Ad4m Posted March 24, 2017 Report 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 Quote Link to comment Share on other sites More sharing options...
samme Posted March 25, 2017 Report Share Posted March 25, 2017 Remember, even when testing groups, the collision callback always contains two sprites: function bulletsColision(bullet, enemy) {/*…*/} szabloreki 1 Quote Link to comment Share on other sites More sharing options...
szabloreki Posted March 25, 2017 Author Report Share Posted March 25, 2017 Thanks, Adam West it's work! Now I can complete my battle system in game! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.