Hello! I have a string of text in my instructions class that says "One Ball!" Its color depends on an integer called "imgNum". For example, when imgNum is equal to 1, the text is blue. So far, my instructions class looks likes this:
and my ball class looks like this:
How can I change the color of the text? There are also other colors than blue like orange and pink
public class Instructions extends Actor { /** * Act - do whatever the Instructions wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public Instructions(String message) { setImage(new GreenfootImage (message, 56, Color.BLACK, Color.WHITE)); } }
if (myCounter.getScore() == MINSCORE ) { if(imgNum == 0) { //blue text } Instructions instruct = new Instructions("One ball!"); Greenfoot.stop(); getWorld().addObject(instruct, getWorld().getWidth()/2, getWorld().getHeight()/2); }