Hi all, I am trying to check what item in a group overlap with the other object. Does anyone has any ideas? Thank you
The two colliding game objects are the arguments to the collision callback.
Thanks, samme, but what I mean in the post is a group (many lands) will overlap with a object (a bullet), and how can I define what land in the group overlapping with the bullet?
Show the overlap code?
This is the code:
this.physics.add.overlap(this.tilesGroup, this.bullet, () => {"check overlap for each item in this.tilesGroup"}
this.physics.add.overlap(this.bullet, this.tilesGroup, (bullet, tile) => {
// …
});
Thanks, samme. The “tile” you mean I need to list all the item in tilesGroup? And so what the function return to define the overlapping “tile”
tile
is the tile that is overlapping with the bullet.
1 Like