markus.n Posted April 24, 2014 Share Posted April 24, 2014 Hi,I need a popup-style text box (sprite image) appear and disappear at times at the bottom of the screen, while everything else stays as it is. However, this sprite doesn't move by tweening, and the problem seems to be the fact that it's fixed to the camera. If I remove that fixedToCamera-line, the tween works just ok, but not with it, there's just no movement whatsoever.I can always console.log the tween object and it looks ok, and .onComplete also fires on time without the tween movement actually happening.Any way around this problem?this.game.load.image('textbg', 'img/general/dummyimage.png');this.textbg = this.game.add.sprite(0, 668, 'textbg');this.textbg.fixedToCamera = true; // Disabling this makes it work!this.textbg.anchor.setTo(0, 0);tween = this.game.add.tween(this.textbg).to({x: 0, y: 468}, 1000, Phaser.Easing.Linear.None, true); Link to comment Share on other sites More sharing options...
Local_Minimum Posted May 24, 2014 Share Posted May 24, 2014 Just bumped into this issue too! The problem is that x and y are the text's world coordinates, so the tween is probably completed before it starts due to that. To change the offset to the camera you should tween the cameraOffset instead:tween = this.game.add.tween(this.textbg.cameraOffset).to({x: 0, y: 468}, 1000, Phaser.Easing.Linear.NoneHowever I think this solution is a bit sub-optimal, in some cases like mine where I would like to have several serial tweens on a text and I want to tween properties of the text (alpha) as well as the offset: I can't pass {alpha: 1, cameraOffset.x: game.width/2} to the tweening due to that the dot is not allowed between cameraOffset and x. Larzan 1 Link to comment Share on other sites More sharing options...
Recommended Posts