Containers vs groups

Hi guys, I’m new to Phaser.
I’m trying to get my head around Containers and Groups.
It seems that Containers have been introduced into Phaser 3 and I can’t find any tutorials regarding them.

Can you please provide some use cases when I use Containers and when should I use Groups?

Thanks.

1 Like

Containers are used when you want two or more game objects to “behave as one”. You can then for example change the alpha, x, y or the depth of the container and it will apply to all of the game objects in that container. Game objects in containers give up some of their freedom however as you won’t be able to add physics to them I believe.

Groups are just storages for game objects. They don’t really offer anything special. They’re used for similiar game objects for quick adding, destroying and keeping track of them.The best use case is bullets.

Examples here: https://labs.phaser.io/index.html?dir=game%20objects/&q=

3 Likes

Thank you very much. This explains it clearly.