This site requires JavaScript, please enable it in your browser!
Greenfoot back
Occaso
Occaso wrote ...

2013/6/20

Changing font and colour

Occaso Occaso

2013/6/20

#
Hey there, I have a little problem. I'm a newbe in programming, so this probably a very simple problem, but it would be great if you could help me ;). At the end of my Game, there is a Game Over screen which shows the time the player "survived".
startTime = System.currentTimeMillis();
endTime   = System.currentTimeMillis();
totalTime = endTime - startTime;
World myworld = getWorld();
GreenfootImage picture1 =new GreenfootImage("gameover.jpg");
int m=(int)(totalTime/1000)/60;
int s=(int)(totalTime/1000)-(m*60);
picture1.drawString(""+m+" minute(s) and " + s +" second(s)",110,280);
myworld.setBackground(picture1);
Of course this isn't the real code how I did it, I just copied the important lines. Everything works fine, but I'd like to change the colour of the text and if possible also the fond and it seems that Google isn't my friend in this case ;) Thanks it advance for your help and sorry if my english isn't perfect ;)
Occaso Occaso

2013/6/20

#
Ok, sorry I found it out right after I postet this ;)
import java.awt.color.*;
import java.awt.Color;
picture1.setColor(Color.YELLOW );
Thread can be closed ;)
You need to login to post a reply.