tanskuu Posted November 28, 2018 Share Posted November 28, 2018 How can i create a tween for a group? enemies2 = this.physics.add.group({ key: 'purple', repeat: 10, velocityY: CPUVelocity, bounceX: 1, collideWorldBounds: true, setXY: { x: enemyStartX / 2, y: 100, stepX: enemyStartX }, }); Link to comment Share on other sites More sharing options...
prob Posted November 28, 2018 Share Posted November 28, 2018 enemies2.getChildren().forEach(function (child) { // tween child }); Link to comment Share on other sites More sharing options...
samme Posted November 28, 2018 Share Posted November 28, 2018 Which properties do you want to tween? Link to comment Share on other sites More sharing options...
tanskuu Posted November 28, 2018 Author Share Posted November 28, 2018 enemies2 = this.physics.add.group({ key: 'purple', repeat: 10, velocityY: CPUVelocity, bounceX: 1, collideWorldBounds: true, setXY: { x: enemyStartX / 2, y: 100, stepX: enemyStartX }, }); enemies2.setVelocityX(25, 10); I would like to make my enemies 2 group do yoyo movement instead of a just moving sideways and bouncing of each other. If that makes sense. I couldnt find a tutorial to how to make a tween for a this kinda group Link to comment Share on other sites More sharing options...
samme Posted November 28, 2018 Share Posted November 28, 2018 this.add.tween({ targets: enemies2.getChildren().map(function (c) { return c.body.velocity }), x: X, y: Y, // … }); or this.tweens.addCounter({ from: X1, to: X2, onUpdate: function (tween) { enemies2.setVelocityX(tween.getValue()); }, // … }); Befive.Info 1 Link to comment Share on other sites More sharing options...
tanskuu Posted November 29, 2018 Author Share Posted November 29, 2018 Thanks for the help! Link to comment Share on other sites More sharing options...
tanskuu Posted December 5, 2018 Author Share Posted December 5, 2018 One more question how can i make a timeline tween for my enemies group? Link to comment Share on other sites More sharing options...
Recommended Posts