GabrielKnight Posted March 25, 2014 Share Posted March 25, 2014 Hello,Please help, I'm trying to explain my problem.function create() {fl = game.add.group();...and we create constructor:flyingScore = function() {this.object = game.add.text(100, 540, "TEST", { font: "18px MS Sans Serif"}, fl);}after actionnew flyingScore();and my update() functionfl.x += 1;fl.y -=1;And question. After action we create new object by flyingScore constructor and put in the group "fl". When object creates for first time, it works well, but if I create another object with constructor - new object doesn't appear. How to create new texts every time and control with whole group ? Sorry for stupid question. Link to comment Share on other sites More sharing options...
Willyfrog Posted March 25, 2014 Share Posted March 25, 2014 Have you tried with addAll? http://docs.phaser.io/Phaser.Group.html#addAllfl.addAll('x', 1); GabrielKnight 1 Link to comment Share on other sites More sharing options...
Heppell08 Posted March 25, 2014 Share Posted March 25, 2014 You only need to create a single text object for things like scores and use the setText method in a function.So:flyingscore = this.add.text( // stuff);Then when the condition is right have the setText waiting in a function:flyingscore.setText('Score:' + score); Link to comment Share on other sites More sharing options...
GabrielKnight Posted March 25, 2014 Author Share Posted March 25, 2014 Willyfrog, this is what I need, thanks!!Thanks for your answers friends. Best Regards, Willyfrog 1 Link to comment Share on other sites More sharing options...
Recommended Posts