Then just remove '.getValue()'.
//This is the code in the car at the moment: if(((Road) getWorld()).timesTouched == 2); ((Road) getWorld()).addObject(this, Greenfoot.getRandomNumber(600), 1); //Any reason why it's not working?
if(timesTouched == 2) { addObject(new Car(), Greenfoot.getRandomNumber(600), 1); }
if(timesTouched == 2) ; addObject(new Car(), Greenfoot.getRandomNumber(600), 1);
if(getOneIntersectingObject(Biker.class) != null){ { ((Road) getWorld()).timesTouched+=1; setLocation(Greenfoot.getRandomNumber(400),1); } }
if (getOneIntersectingObject(Biker.class) != null) { ((Road)getWorld()).timesTouched += 1; if (((Road)getWorld()).timesTouched == 2) addObject(new Car(), Greenfoot.getRandomNumber(600), 1); setLocation(Greenfoot.getRandomNumber(400), 1); }