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?


1 2 3 4 5 6 7 8 9 10 11 | 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); } |
1 | setPaintOrder(Text. class , Timer. class ); |
1 | GreenfootImage timerImage = new GreenfootImage(timer, 25 , Color.BLACK, Color.WHITE); |
1 | getWorld().getBackground().drawImage(timerImage, timerObject.getX(), timerObject.getY()); |