icp Posted August 5, 2015 Share Posted August 5, 2015 I'm using a tween that changes the texture of a Sprite when onComplete method gets called. Sometimes it fails to change the texture via this.sprite.loadTexture('myTexture'); . Everything works fine with Phaser 2.3 . jdnichollsc 1 Link to comment Share on other sites More sharing options...
icp Posted August 6, 2015 Author Share Posted August 6, 2015 Any feedback? Link to comment Share on other sites More sharing options...
yahiko Posted August 6, 2015 Share Posted August 6, 2015 You should post the most significant part of your code. Without it, it would be almost impossible to answer anything. Link to comment Share on other sites More sharing options...
icp Posted August 6, 2015 Author Share Posted August 6, 2015 You should post the most significant part of your code. Without it, it would be almost impossible to answer anything.This is the problem:this.sprite.loadTexture('myTexture'); jdnichollsc 1 Link to comment Share on other sites More sharing options...
icp Posted August 11, 2015 Author Share Posted August 11, 2015 Anyone having the same problem? Link to comment Share on other sites More sharing options...
tips4design Posted August 11, 2015 Share Posted August 11, 2015 I have recently used loadTexture and it worked as expected. You should create a fiddle where it is not working. You should also post the code where you load the textures and where you create the sprite. Link to comment Share on other sites More sharing options...
icp Posted August 11, 2015 Author Share Posted August 11, 2015 this.spriteTween = this.game.add.tween(this.sprite); this.spriteTween.to({angle: 180}, 1000, Phaser.Easing.Linear.None, false, 0); this.spriteTween.onStart.add(startIt, this); this.spriteTween.onComplete.add(resetIt, this); function startIt() { this.sprite.loadTexture('monster'); } function resetIt(){ this.sprite.loadTexture('hero'); } Link to comment Share on other sites More sharing options...
icp Posted August 18, 2015 Author Share Posted August 18, 2015 Guess I will keep using 2.3 . Link to comment Share on other sites More sharing options...
tips4design Posted August 18, 2015 Share Posted August 18, 2015 Are you creating this tween only once? If you create it inside a loop you might overwrite the tween before it actually reaches completion. Link to comment Share on other sites More sharing options...
icp Posted August 18, 2015 Author Share Posted August 18, 2015 I am creating the tween only once and than I use .start() and .stop() when I need it. Link to comment Share on other sites More sharing options...
tips4design Posted August 18, 2015 Share Posted August 18, 2015 You know that if you use .stop(), onComplete is not trigged, right? http://phaser.io/docs/2.4.2/Phaser.Tween.html#stop Link to comment Share on other sites More sharing options...
icp Posted August 18, 2015 Author Share Posted August 18, 2015 I use it properly. Everything works fine in 2.3 . The problems appear only in 2.4.2.You know that if you use .stop(), onComplete is not trigged, right? http://phaser.io/docs/2.4.2/Phaser.Tween.html#stopSet to true to dispatch the Tween.onComplete signal. jdnichollsc 1 Link to comment Share on other sites More sharing options...
tips4design Posted August 18, 2015 Share Posted August 18, 2015 Can you recreate this issue in a fiddle? Try editing this one to reproduce your error: http://jsfiddle.net/5qzjjegt/4/ Link to comment Share on other sites More sharing options...
Recommended Posts