Zackorz Posted March 7, 2016 Share Posted March 7, 2016 I use tweens for my movement of sprite objects. These sprites are generated randomly and getting pushed into an array. When the sprite movement has finnished, i want to destroy them and removed also their position in the array. Im trying to do it with the "onComplete" function but i dont know how i can figure out which sprite has finished his movement and can be deleted. Is it possible to get some feedback from "onComplete" that tells me which sprite has "completed" his movement ? Link to comment Share on other sites More sharing options...
Zackorz Posted March 8, 2016 Author Share Posted March 8, 2016 Any idea, how i can get the sprite name that completed his movement? It would also help, if there would be a check that tells me if a sprite is moving. Link to comment Share on other sites More sharing options...
drhayes Posted March 8, 2016 Share Posted March 8, 2016 Wherever it is that you start the tween you have reference to the sprite, right? Because it's the sprite that you're tweening? Phaser signals can take args like this: // enemy1 is the sprite you care about... game.add.tween(enemy1).to(...).onComplete.add(this.handleOnComplete, this, null, enemy1); enemy1 will be passed as the first and only argument to this.handleOnComplete. Link to comment Share on other sites More sharing options...
Recommended Posts