So I'm trying to display some text and then change it using this code:
I don't quite understand why it is not working, when I click it doesn't change messages. If anyone would help me out it would be much appreciated!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | /** * Act - do whatever the Title wants to do. This method is called whenever * the 'Act' or 'Run' button gets pressed in the environment. */ public void act() { Text1(); Text2(); } public void Text1() { //Displays initial message setImage( new GreenfootImage( "Zaneth was once a peacful place...serene...pure..." , 18 , Color.YELLOW, Color.BLACK)); Text2(); } public void Text2() { //On clicked, switch to message part 2 if (Greenfoot.mouseClicked( null )) { setImage( new GreenfootImage( "But all things end, and Felix the Terrible rose to power..." , 18 , Color.YELLOW, Color.BLACK)); } } } |