After racking my brain, I still haven't been able to get a good solution to this whole live score problem.
The situation is that I need an integer to be converted to a string every so many cycles. This string needs to be drawn onto a fancy image representing the Actor subclass in question (which contains a space for the player's score, that increments over time); this image is saved onto the World.
The main issue is that the drawn string needs to be cleared each time before for the next string is drawn onto the image. Otherwise, the strings overlap and it all looks messy. I also need help setting things to do with the font, like size and colour.
In short:
An integer value increases after set intervals of time.
At each interval, that integer must be converted to a String, and be drawn onto the Actor's image.
In addition, the font needs to be set, the colour of the font, and its size.
Here's my progress so far (not that it works...) :
As usual, all help is welcome, and much appreciated!
private int score = 0; private int scoreCount = 0; private String scoreValue = ""; public void act() { scoreCount++; if (scoreCount % 20 == 0) { incrementScore(); } } private void incrementScore() { score++; setColor(Color.red); Font arialFont = new Font(arial, Font.BOLD, 16); setFont(arialFont); scoreValue = Integer.toString(score); this.getImage().drawString(scoreValue, 10, 10); }