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

2014/8/10

How to add text

sengst sengst

2014/8/10

#
Hello. I was wondering how to add text? Thanks!
ravindrapawar ravindrapawar

2014/8/10

#
where u want to add text?
sengst sengst

2014/8/10

#
on a world.
danpost danpost

2014/8/10

#
If you have Greenfoot 2.4, you can use the 'showText' method. If not, you can: (1) use 'getBackground().drawString(String, int, int)'; or (2) create a GreenfootImage using the GreenfootImage(String, int, Color, Color) method and either: (a) use 'getBackground().drawImage(GreenfootImage, int, int)'; or, (b) create an actor object and set the image to it and add it to the world
sengst sengst

2014/8/10

#
Great thanks! now is the a way to make it thicker and Maybe bigger?
danpost danpost

2014/8/10

#
sengst wrote...
Great thanks! now is the a way to make it thicker and Maybe bigger?
Use method 2. The 'int' argument of that GreenfootImage constructor is the font size. For example:
1
getBackground().drawImage(new GreenfootImage("Text to display", 64, null, null), 40, 40);
ravindrapawar ravindrapawar

2014/8/10

#
danpost i want to meet u on skype..plz add me on ravipawar13
sengst sengst

2014/8/10

#
Thank you so much! This really helped me! Seems like you know Greenfoot!
ravindrapawar ravindrapawar

2014/8/10

#
i am also new on greenfoot..plz tell me how to do programming in greenfoot??
CooliMC CooliMC

2014/8/10

#
you must learn it yourself :D if you want to know something google it and then practise on your own and when it wont work after a while then you can ask the forum here :D thats the best way to learn it :D
danpost danpost

2014/8/14

#
@sengst, I uploaded a new scenario that has a supporting class for GreenfootImage the helps in creating text images. You may want to check this out.
sengst sengst

2014/8/20

#
ok, thanks
You need to login to post a reply.