Hi, In the game I want a text box to pop up that writting in it when ever you click on some actors... I have if(Greenfoot.mouseClicked(this)); but thats it... I'm not sure how to get the rest...
Hi, In the game I want a text box to pop up that writting in it when ever you click on some actors... I have if(Greenfoot.mouseClicked(this)); but thats it... I'm not sure how to get the rest...
I tried this
if(Greenfoot.mouseClicked(this))
new TextArea("Hello", 400, 400);
there are no syntax errors but nothing happens when I click on the actor...
I tried this
if(Greenfoot.mouseClicked(this))
new TextArea("Hello", 400, 400);
there are no syntax errors but nothing happens when I click on the actor...
Looks like you are creating the actor but not placing it into the world.
it's in the world... but nothing happens when clicked on. here is all the code in the actor.
import greenfoot.*;
import java.awt.*;
public class Springbot extends Actor
{
public void act()
{
if(Greenfoot.mouseClicked(this))
new TextArea("Hello", 400, 400);
}
}
so how can I just add it to an actor instead of making it an actor?
What ?? I indicated that you created one. Creating it does not put it in your world, however. You need to add that (created) TextArea object into the world to make it show.