rickbross Posted July 22, 2014 Share Posted July 22, 2014 So, say I have the variable Window.points, and say.. Window.points += 10 How can I fire a function every time I do that? There is game.input.onDown, but is there a variable this.variable.onChange? Link to comment Share on other sites More sharing options...
Dumtard Posted July 22, 2014 Share Posted July 22, 2014 Just change the text to the variable right after adding to. function scored(points){ Window.points += points; Window.scoreboard.text = 'Score: ' + Window.points;}where scoreboard is your Phaser text object. Link to comment Share on other sites More sharing options...
Heppell08 Posted July 22, 2014 Share Posted July 22, 2014 var updateText;updateText = game.add.text(10,10,'Points:');// update loop belowupdateText.setText('Points:' + window.points);with setText it will update the text when you require it to do so. Link to comment Share on other sites More sharing options...
Recommended Posts