Physics not working on some instances of a group

#1

In my game fruit are being spawned from the left and right and the game checks for physics.arcade.overlap to cut them. The issue is when I spawn more than one coconut the physics only applies to one coconut. I believe this is because every time it spawns I’m defining it as coconut1 so the previous one is overwritten. I’m using a timed event to spawn the coconuts, what would be the best way to have every coconut that spawns have the same set of physics applied to it. Thank you for any help

q3 q1 q2

#2

Hi,

I thnik the best way is to use a Phaser group, so every coconut will behave the same

Try something like this https://phaser.io/examples/v2/groups/add-a-sprite-to-group

And dig around this example https://phaser.io/examples/v2/arcade-physics/custom-sprite-vs-group