Armox Posted June 20, 2018 Share Posted June 20, 2018 Okay so I'm creating game sprites like so: game.create = function() { this.player = this.add.text(0, 0, "?", { font: '64px Sans Open' }).setInteractive(); } I'm intending to animate them by switching to different emoji. Throw up animation for example: ?>?>? All the animation info I come across pertains to animating sprite sheets (understandably so). Forgive me, I'm brand new to Phaser, but this is what I tried: let timelineTween = this.tweens.createTimeline(); timelineTween.add({ targets: this.player, duration: 600, x: newItem.x, y: newItem.y, onComplete: function() { gameScene.add.tween(this).to({ alpha: 1 }, 2000, "Linear", true); this.targets[0].text = "?"; } Although it did change the text value of player, it didn't render any differently on screen. Link to comment Share on other sites More sharing options...
Legomite Posted June 20, 2018 Share Posted June 20, 2018 I'm quite new to Phaser too but I believe text objects must be updated via .updateText() to show the change or if you want to set it in one line without doing the two separately you can do this: this.targets[0].setText("?"); DVCT and Armox 1 1 Link to comment Share on other sites More sharing options...
Armox Posted June 20, 2018 Author Share Posted June 20, 2018 Yep, that did it. Thanks so much! Link to comment Share on other sites More sharing options...
Eurico Posted July 18, 2018 Share Posted July 18, 2018 See my game emojigame.azurewebsites.net Link to comment Share on other sites More sharing options...
Recommended Posts