Americkan Posted March 9, 2017 Share Posted March 9, 2017 Hey guys. I am making a little quiz form and I ran into some trouble. I would like the score to be updated depending on whether they got the question right or wrong. I am new to phaser and would like guidance as to how to do so. Ty. Link to comment Share on other sites More sharing options...
Xesenix Posted March 9, 2017 Share Posted March 9, 2017 var score = null// move score outside of create function create() { ... score = game.add.text(...) } function firstResponse() { ... // on good answer count += 1; score.text = "Score:" + count; } function secondResponse() { ... // on bad answer count -= 1; score.text = "Score:" + count; } You need some global accessible label so you can update its content after clicking anwser Link to comment Share on other sites More sharing options...
Americkan Posted March 10, 2017 Author Share Posted March 10, 2017 2 hours ago, Xesenix said: var score = null// move score outside of create function create() { ... score = game.add.text(...) } function firstResponse() { ... // on good answer count += 1; score.text = "Score:" + count; } function secondResponse() { ... // on bad answer count -= 1; score.text = "Score:" + count; } You need some global accessible label so you can update its content after clicking anwser Thank you very much for the help! It worked and you've helped me greatly. +1 Link to comment Share on other sites More sharing options...
Recommended Posts