I have a group of batteries and a player. I want to check if player overlapped a battery:
var isOverlapping = TopDownGame.game.physics.arcade.overlap(player, batteries, null, null, this);
if (isOverlapping) {
//reference to overlapped battery ??
}
But how to get reference element of batteries group which I overlapped with?
I can’t use common method like game.physics.arcade.overlap and that handle callback because I do all this not in game loop.
AFAIK, if your group is called batteries the overlap method should fires on every element of the group, but to get a specifical battery it has to be referenced somewhere
So to continue on this way I think you have to look at the space invaders example on the site because it kills one ship at a time but am not sure it uses’s the group method