# Move group as a whole, move all sprites by the same offset?

**URL:** <https://phaser.discourse.group/t/move-group-as-a-whole-move-all-sprites-by-the-same-offset/3177>\
**Category:** Phaser 3\
**Created:** [July 20, 2019, 3:42pm UTC](https://phaser.discourse.group/t/move-group-as-a-whole-move-all-sprites-by-the-same-offset/3177 "2019-07-20T15:42:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BdR](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/bdr/32/2621_2.png) [@BdR](https://phaser.discourse.group/u/BdR)\
**Post date:** [July 20, 2019, 3:42pm UTC](https://phaser.discourse.group/t/move-group-as-a-whole-move-all-sprites-by-the-same-offset/3177/1 "2019-07-20T15:42:11Z")

</div>

In Phaser 2 it was possible to add sprites to a group and then move the group as a whole. All the sprite positions in the group were relative to the group position, so if the group is at pos 0,0 and sprite is at 40,30 it works as normal. But if you then moved the group 100 pixels to left, all sprites in group would move, while each individual sprite position was unchanged. So the sprite would be on screen at position 140,30 while its x,y position was still 40,30.

![sprite_group](https://global.discourse-cdn.com/free1/uploads/phaser1/original/2X/7/7d624e681009fa38d98c1fc611cefd0344cc403d.png)

It seems that this works differently in Phaser 3, is something like that still possible? The group position x,y can be set at `create` but when I try to change the value it seems that `group.x` and `group.y` are undefined. I’ve looked [here](https://labs.phaser.io/index.html?dir=game%20objects/group/&q=) and [here](https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.Group.html) but couldn’t find it.

Also, I’ve used the group scale effect in Phaser2, which was really useful. You could set the anchor of the group and then scaling the group would scale all sprites around that origin point, which was helpful for some animation effects.

---

<div class="post-metadata">

**Author:** ![Telinc1](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/telinc1/32/60_2.png) [@Telinc1](https://phaser.discourse.group/u/Telinc1)\
**Post date:** [July 20, 2019, 3:58pm UTC](https://phaser.discourse.group/t/move-group-as-a-whole-move-all-sprites-by-the-same-offset/3177/2 "2019-07-20T15:58:00Z")

</div>

Groups behave in entirely different ways in Phaser 2 and Phaser 3. The latter has a flat display list and Groups are essentially arrays of Game Objects. The properties in the constructor’s configuration object are used only to create the Group’s initial children. If you want to operate on a Group’s children, you can look at the [`Phaser.Actions` namespace](https://photonstorm.github.io/phaser3-docs/Phaser.Actions.html).

Alternatively, Phaser 3 also offers [Containers](https://photonstorm.github.io/phaser3-docs/Phaser.GameObjects.Container.html) - Game Objects which behave like Phaser 2’s Groups. If you want to treat multiple Game Objects as one whole, Containers are the easiest solution.

---

<div class="post-metadata">

**Author:** ![BdR](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/bdr/32/2621_2.png) [@BdR](https://phaser.discourse.group/u/BdR)\
**Post date:** [July 20, 2019, 8:50pm UTC](https://phaser.discourse.group/t/move-group-as-a-whole-move-all-sprites-by-the-same-offset/3177/3 "2019-07-20T20:50:34Z")

</div>

Thanks, didn’t know about the container class, that’s exactly what I was looking for. 🙂 👍 The scaling effect also works using this.
