Hello,
I am working on a project but I'm having some troubles with accessing of the string "ime" of class "destinacija", from another class called "Bern" (that is subclass from towns ).
Here is code from class Bern:
And the code from Destinacija class (means destination):
I would really appreciate all the help :)
public class Bern extends Mesto
{
public Bern()
{
super();
ime = "Bern";
setImage("mesto.jpg");
}
public void act()
{
Mesto mesto = (Mesto)getOneIntersectingObject(Mesto.class);
//here is suposed to be access code to ime (string inside of destinacija class)
if(Greenfoot.isKeyDown("down") && isTouching(Letalo.class)){
if ("Bern" == /* same ime as chosen in destinacija */){
Greenfoot.playSound("bern.mp3");
}
}
}
}public class Destinacija extends Actor
{
public void act() {
//
}
public void izpisi(){
Start mojsvet = (Start)getWorld();
String ime = mojsvet.izbranoMesto.ime;
setImage(new GreenfootImage("Destinacija: " + ime , 24, Color.BLACK, Color.WHITE));
}
}
