I am going through the Zenva tutorial course, and I have come across something pretty simple that isn’t working for me. I have probably missed something really obvious.
In the course, he is using restart() to begin paused tweens. But it isn’t working. I debugged into Phaser and it seems the state of my tween is “pending_add” which causes the restart to abort. Using play() works fine to begin them but I am wanting to understand what “pending add” means and why I would be in that state that would cause restart() to not work. Here is the pretty simple code (for space, I am only including the Phaser.Actions.Call where it is applying the tween events to each member of a group; if more is needed, please let me know):
Phaser.Actions.Call(this.items.getChildren(), function(item){
item.setInteractive();
//creating tween - resize tween
item.resizeTween = this.tweens.add({
targets: item,
scaleX: 1.5,
scaleY: 1.5,
duration: 300,
paused: true,
yoyo: true
});
//transparency tween
item.alphaTween = this.tweens.add({
targets: item,
alpha: 0.7,
duration: 200,
paused: true
});
item.on('pointerdown', pointer => {
item.resizeTween.restart();
});
//listen to the pointerover event
item.on('pointerover', pointer => {
item.alphaTween.restart();
});
item.on('pointerout', pointer => {
item.alpha = 1;
});
}, this);
Thank you for any assistance!