Jump to content

Tween oncomplete : target same element


Zintin1
 Share

Recommended Posts

Hello,

On my project I have a function that repeat everysecond, in this function I create a star, which I animated with a tween, and make it disappear 1 second later. My problem is I can't target the star who just appear, all my stars disappear (obviously because they get all the same name "star"). So I should use game.add.tween(this) on the onComplete but it doesn't work.

game.add.tween(star.scale).to({x: 1, y: 1}, 400, Phaser.Easing.Bounce.Out, true).onComplete.add(function() {
     game.add.tween(star).to({alpha: 0}, 400, Phaser.Easing.Linear.None, true, 1000);
});

 

Thanks

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...