Natman Posted March 29, 2014 Share Posted March 29, 2014 I'm trying to use tweens to transition a menu off of the screen. The menu contains a backdrop sprite and several Text objects. When it's closed, I create tweens to move all of these elements upward off the screen. For some reason, the backdrop tweens perfectly and the text doesn't move at all, even though the code is basically the same://tween upwardsvar tween = game.add.tween(this.backdrop);tween.to({y: -this.backdrop.height}, 500, Phaser.Easing.Linear.None, true);tween.onComplete.add(this.destroy, this);game.add.tween(this.titleText1).to({y: this.titleText1.y - this.backdrop.height}, 500, Phaser.Easing.Linear.None, true);game.add.tween(this.titleText2).to({y: this.titleText2.y - this.backdrop.height}, 500, Phaser.Easing.Linear.None, true);game.add.tween(this.msgText).to({y: this.msgText.y - this.backdrop.height}, 500, Phaser.Easing.Linear.None, true);The onComplete event I attach to the backdrop tween is for triggering the actually destruction of the menu. I'm using Phaser 2.0 and I don't want to upgrade for my current project. Link to comment Share on other sites More sharing options...
jflowers45 Posted March 31, 2014 Share Posted March 31, 2014 Getting any console errors? I'd try isolating the issue to something as narrow as possible. First I'd get rid of the tween on the backdrop and make sure that's not somehow affecting the other ones (maybe the onComplete has something weird in it) Then I'd try hardcoding a value for y: instead of having it mathematically calculated. Seems dumb but worth a shot, might provide an insight Here's a text tween example that does work, in case it helps http://flashysubstance.com/phaserTextTween/ Natman 1 Link to comment Share on other sites More sharing options...
Natman Posted April 1, 2014 Author Share Posted April 1, 2014 There are no console errors and a hard coded value doesn't fix it. I'll look at your example Link to comment Share on other sites More sharing options...
jflowers45 Posted April 1, 2014 Share Posted April 1, 2014 cool - if you still have issues feel free to post a full example that reproduces it Natman 1 Link to comment Share on other sites More sharing options...
Natman Posted April 1, 2014 Author Share Posted April 1, 2014 I found the source of the problem: I had written a function to create the Text objects for me, and the reference the function returned was not tweenable for whatever reason. I replaced all uses of my function with game.add.text() and it works fine. Thanks for the debugging suggestions, they put me on the right track! jflowers45 1 Link to comment Share on other sites More sharing options...
jflowers45 Posted April 2, 2014 Share Posted April 2, 2014 excellent, glad it worked out! Link to comment Share on other sites More sharing options...
Recommended Posts