Hi guys, i need some help.
public class Start extends Actor
{
public int language = 0;
public Start()
{
GreenfootImage start = getImage();
start.setFont(new java.awt.Font("Helvetica", Font.PLAIN, 16));
start.drawString("Start", 11, 34);
setImage(start);
}
public int getLanguage()
{
return language;
}
public void setLanguage(int value)
{
language = value;
}
Here i declared a variable language, set his value and return the value in an actor named Start.
public void act()
{
if (Greenfoot.mouseClicked(this))
{
MyWorld world =new MyWorld();
world.getObjects(Start.class).get(0).setLanguage(1);
Greenfoot.setWorld(new Play());
}
}
Here i want to see if the actor Ro was clicked and set the language to the value 1. There will be another actor En which will set the value 2.
public void act()
{
MyWorld world = new MyWorld();
getImage().scale(200,120);
if(world.getObjects(Start.class).get(0).getLanguage() == 1)
{GreenfootImage bej = getImage();
bej.setFont(new java.awt.Font("Helvetica", Font.PLAIN, 16));
bej.drawString("Bej", 11, 25);
setImage(bej);
if(Greenfoot.mouseClicked(this))
{
}
}
else
if(world.getObjects(Start.class).get(0).getLanguage() == 2)
{ if(Greenfoot.mouseClicked(this))
{
}
}
}
In the actor Bej i want to see if the value of language is 1, to add a text to the image (this doesn't work, there doesn't appear any text). What can i do? Did I checked in the correct way the value? Can you help me? And I hope you understood my problem.
And i'm sorry for my english, i'm not very good :)

