Jump to content

Tween oncomplete : target same element


Recommended Posts


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);



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

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