Moving a group

Task: move a group of elements by a given value.
Question: did I solve the problem correctly?
P. s. I’m a junior at Phaser. It is a pity that there is no solution in to labs.phaser.io

 var config = {
    type: Phaser.WEBGL,
    width: 800,
    height: 600,
    parent: 'phaser-example',
    scene: {
        preload: preload,
        create: create
    }
};

var game = new Phaser.Game(config);

function preload ()
{
    this.load.image('mushroom', 'assets/sprites/mushroom2.png');
}

function create ()
{
    var sprite = this.add.image(300, 300, 'mushroom');
    this.tweens.add({
			targets: sprite,
			y: sprite.y+90,
			duration: 2000
		});
        
    var group = this.add.group();
    group.add(this.add.image(200, 100, 'mushroom'));
    group.add(this.add.image(300, 200, 'mushroom'));
    group.add(this.add.image(400, 300, 'mushroom'));


    Phaser.Actions.Call(group.getChildren(), (function(context){ return function(go) {
            context.tweens.add({
                targets: go,
                y:go.y+90,
                x:go.x+90,
                duration: 2000
            });
        }})(this)
    );

}

Could also do something like:

this.tweens.add({
    targets: group.getChildren(),
    y: '+=90',
    x: '+=90',
    duration: 2000
});
2 Likes