Hello
In my game I want to add score, I have created a variable named score and succesfully added the score number in the main game loop. I traced it to see if it increases and it does.
Now I want to show the score to the user and I created a new movieclip named "xScore", in it I made a dynamic text box and given it an instance name - "gameScore".
In my game class I declared the gameScore variable:
Code:
public var gameScore:xScore;
Then created the text box in the game constructor:
Code:
gameScore = new xScore();
gameScore.x=10;
gameScore.y=10;
addChild(gameScore);
Finally I tried to show the score varaible in my main game loop:
Attempt 1:
Code:
gameScore.text=score;
Attempt 2:
Code:
gameScore.text=score.toString();
None worked and I don't get any errors, the random number i typed in the dynamic text box doesn't change, I also tried to leave it blank, which didn't work either.