I have an object Timer and I need to put text image on it. I create and update this image in Timer class. But every time this text image goes behind the actor. How to bring text image to the front?
public void act() {
World w = getWorld();
int x = getX();
int y = getY();
//only if it rotates
int r = getRotation();
w.removeObject(this);
w.addObject(this,x,y);
//only if it rotates
setRotation(r);
}setPaintOrder(Text.class, Timer.class);
GreenfootImage timerImage = new GreenfootImage(timer, 25, Color.BLACK, Color.WHITE);
getWorld().getBackground().drawImage(timerImage, timerObject.getX(), timerObject.getY());