ObjektnoPR wrote...
I have subclasses of Mesto because when a player lands a plane, anthem of that specific country plays. For that I do need subclasses right?
public class Mesto extends Actor
{
public boolean izbrano = false;
public String ime;
ArrayList<Mesto> allmesta;
private GreenfootSound hoverSound;
public void Mesto(){
//super();
allmesta = new ArrayList<Mesto>();
String[] ime = {"Bern", "Tirana", "Budimpesta", "Sofia", "Pristina", "Podgorica", "Ljubljana", "Skopje", "Dunaj", "Zagreb", "Rim", "Beograd", "Sarajevo"};
hoverSound = new GreenfootSound(ime.toLowerCase()+".mp3");
setImage("mesto.jpg");
}
public void act(){
if (Greenfoot.isKeyDown("down") && isTouching(Letalo.class) && !hoverSound.isPlaying()){
hoverSound.play();
}
}
}hoverSound = new GreenfootSound(ime.toLowerCase()+".mp3");
Ljubljana ljubljana = new Ljubljana(); addObject(ljubljana, 480, 225); mesta.add(ljubljana);
// change the 'public Mesto()' constructor to
public Mesto(String imeValue)
{
ime = imeValue;
hoverSound = new GreenfootSound(ime.toLowerCase()+".mp3");
setImage("mesto.jpg");
}Mesto bern = new Mesto("Bern");public class Mesto extends Actor
{
public boolean izbrano = false;
public String ime;
private GreenfootSound hoverSound;
public void Mesto(String imeValue){
ime = imeValue;
//String[] ime = {"Bern", "Tirana", "Budimpesta", "Sofija", "Pristina", "Podgorica", "Ljubljana", "Skopje", "Dunaj", "Zagreb", "Rim", "Beograd", "Sarajevo"};
hoverSound = new GreenfootSound(ime + ".mp3"); //i remover toLowerCase method, and I renamed sound files
//hoverBakground = new (ime+".jpg"); (i need new background, not image, sorry for not being specific enough)
setImage("mesto.jpg");
}
public void act(){
if (Greenfoot.isKeyDown("down") && isTouching(Letalo.class) && !hoverSound.isPlaying()){
hoverSound.play();
}
}
}if (Greenfoot.isKeyDown("down") && isTouching(Letalo.class) && ((Start)getWorld()).izbranoMesto == this && !hoverSound.isPlaying()){