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

2013/9/18

How to disappear text after it is displayed

dhruvsheth7 dhruvsheth7

2013/9/18

#
do anyone know how to make the text disappear after particular condition is satisfied
danpost danpost

2013/9/18

#
Show how the text is displayed to begin with.
dhruvsheth7 dhruvsheth7

2013/9/18

#
GreenfootImage msg=getImage(); msg.setColor(Color.BLACK); float fontSize = 25; Font font = msg.getFont().deriveFont(fontSize); msg.setFont(font); msg.drawString("Have Coin",100,400); Greenfoot.playSound("Drop.mp3");
danpost danpost

2013/9/18

#
How about 'getImage().clear();' to remove the message (or: 'if (conditionIsSatisfied) getImage().clear();').
dhruvsheth7 dhruvsheth7

2013/9/19

#
how to display an image after mu condition is satisfied?
dhruvsheth7 dhruvsheth7

2013/9/19

#
and thank you for the previous help
dhruvsheth7 dhruvsheth7

2013/9/19

#
i made the use of the code similar to the below one if (getObjects(Fish.class).size() < 15) addObject(new Fish(),getWidth()-1, Greenfoot.getRandomNumber(getHeight()); but m not able to solve it
dhruvsheth7 dhruvsheth7

2013/9/19

#
i found how to display image but i want to know how to display random image from selected 3 image
danpost danpost

2013/9/19

#
Download my new Help Methods scenario and open the 'XWorld' class code (you will need to change the view from 'Documentation' to 'Source code'). There is a method called 'choose' that would be helpful. You could either learn from the code and create your own for your situation or you could use the method as is, supplying the three GreenfootImage objects to choose from. If using as is, you will have to re-typecast the returned Object object back to a GreenfootImage object (refer to the 'MyWorld' class code where I add either a Bug or a Fly object into the world using the 'choose' method).
dhruvsheth7 dhruvsheth7

2013/9/19

#
m not able to download it
danpost danpost

2013/9/19

#
How are you going to take the image chosen and display it?
dhruvsheth7 dhruvsheth7

2013/9/19

#
by making the use of getObject() method
dhruvsheth7 dhruvsheth7

2013/9/19

#
again my doubt of image is cleared bit now another query is that after my one condtion is satisfied bt at that time i have to display text for few seconds and than make it go away what should i do for that
danpost danpost

2013/9/19

#
There is no 'getObject()' method. Are you coding this in your world class code?
You need to login to post a reply.